Subhash Mantha SAS Developer

Slides:



Advertisements
Similar presentations
PhUSE 2010 Unit Testing and Code Coverage Assessment with SASUnit - Key Technologies for Development of reliable SAS Macros - HMS Analytical Software.
Advertisements

Delivering Multi-Sheet Excel Reports from a Parameterized Stored Process TU02 Richard DeVenezia, Independent Consultant Harry Droogendyk, Stratia Consulting.
Fox Scientific, Inc. ONLINE ORDERING 101. Welcome to our website On our main page you can find current promotions, the vendors we offer, technical references.
XML in a SAS World Mike Molter d-Wise Technologies.
Axio Research E-Compare A Tool for Data Review Bill Coar.
TDPS Wireless v Enhancements E1 - Multi load E2 - Driver time scheduler.
OpalisRobot™ Demonstration Actual Run Book Procedure Actual Data center Run Book Procedure documenting for Level 1 staff how to both VERIFY.
Guide to extract/download multiple databases from Mainframe Tapes to PC using SAS PC Fereydoun J. Foroudian Blue Cross of California SAS is a registered.
Basic And Advanced SAS Programming
TUTORIAL NO. 24 Create Alerts and files in EBSCO.
Let SAS Do the Coding for You! Robert Williams Business Info Analyst Sr. WellPoint Inc.
Chapter 18: Modifying SAS Data Sets and Tracking Changes 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Today:. Colorado Space Grant Consortium Gateway To Space ASEN / ASTR 2500 Class #06 Gateway To Space ASEN / ASTR 2500 Class #06 T-53.
1 The Problem Do you have: A legacy ABL system with millions of Lines of ABL Code? Years and years of modifications to your ABL code? System documentation.
SAS Macros ® 101 How I learned to stop worrying and love macros Alex Chaplin BCS USA Section.
Managing Passwords in the SAS System Allen Malone Senior Analyst/Programmer Kaiser Permanente.
Hello SAS 9.4: What's New? ChrIs Hemedinger, SAS.
Files COP3275 – PROGRAMMING USING C DIEGO J. RIVERA-GUTIERREZ.
An Animated Guide©: Sending SAS files to Excel Concentrating on a D.D.E. Macro.
%rtf2data: A utility macro to convert RTF Table to SAS® dataset
What is a Database? A Database is…  an organized set of stored information usually on one topic  a collection of records  a way to organize information.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
1 Back Up with Each Submit One approach for keeping a dynamic back up copy of your current work.
RMS Importer Status MACS Week March 2011 PP b-ABR_RMSImporterStatus Angela Brett RMS Importer Status 1.
Macro Overview Mihaela Simion. Macro Facility Overview Definition : The SAS Macro Facility is a tool within base SAS software that contains the essential.
1 SAS 1-liners SAS Coding Efficiencies. 2 Overview Less is more Always aim for robust, reusable and efficient code Coding efficiency versus processing.
June 12, 2009 Toronto Area SAS Society 1 What’s new in BASE SAS 9.2 Checkpoint/Restart Rupinder Dhillon Dhillon Consulting Inc.
1 Efficient SAS Coding with Proc SQL When Proc SQL is Easier than Traditional SAS Approaches Mike Atkinson, May 4, 2005.
Define your Own SAS® Command Line Commands Duong Tran – Independent Contractor, London, UK Define your Own SAS® Command Line Commands Duong Tran – Independent.
Chapter 8 File-Oriented Input and Output. 8.1 INTRODUCTION a file can also be designed to store data. We can easily update files, A data file as input.
Storing and Retrieving Data
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Files & Directories.
Here’s another problem (see section 2.13 on page 54). A file contains two different types of records (say A’s and B’s) and we only want to read in the.
Tips & Tricks From your fellow SAS users 9/30/2004.
While You Were Sleeping… SAS Is Hard At Work Andrea Wainwright- Zimmerman.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
GAME203 – C Files stdio.h C standard Input/Output “getchar()”
1 Colorado Space Grant Consortium Gateway To Space ASEN / ASTR 2500 Class #13 Gateway To Space ASEN / ASTR 2500 Class #13.
Files A collection of related data treated as a unit. Two types Text
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Lecture 5 Page 1 CS 111 Summer 2013 Bounded Buffers A higher level abstraction than shared domains or simple messages But not quite as high level as RPC.
Oracle sql Online Training By SMART MIND ONLINE TRAINING Website:
Using the Macro Facility to Create HTML, XML and RTF output Rick Langston, SAS Institute Inc.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
Hints and Tips SAUSAG Q SORTING – NOUNIQUEKEY The NOUNIQUEKEY option on PROC SORT is a useful way in 9.3 to easily retain only those records with.
Local Government Corporation Resource 2016 NextGen Trustee Year End.
Chapter 6 Persistence-Saving and Retrieving Data
Anti-Money laundering Solution
Modules State College of Florida
Web address to access School of Medicine Applications:
SAS Macro Language.
Chapter 18: Modifying SAS Data Sets and Tracking Changes
On transactions, and Atomic Operations
Budget Prep FY2019 Lessons Learned and Future Enhancements
SESUG Web Scraping in SAS: A Macro-Based Approach
Global and Local Symbol Tables
How to Create Data Driven Lists
On transactions, and Atomic Operations
3 Parameter Validation.
A gentle introduction to RESTful APIs
Using Templates and Library Items
Files.
Detecting Runtime Errors and Exiting from Nested Macros Gracefully
Trigger %macro check_trigger_run;
Chapter 15: File System Internals
Tips and Tricks for Using Macros to Automate SAS Reporting.
Automate & Zip files Using MACRO
Reporting 101 Keenan & Mona.
Files Chapter 8.
Presentation transcript:

Subhash Mantha SAS Developer

Audit trail Important in the following fields Clinical Trials Financial Companies Product Development Answers four important questions When Why How Who

Some of the parameters used for Trail Capturing Date Time Who ran the program Run time of the program

Methods for capturing a trail SAS Logs Excel Files XML files SAS Datasets CSV/Text Files

SAS Way of capturing a trail Datasets Append Modify Recreate External files Append Recreate

Trail by datasets Data step Set Modify Proc step Append

Trail by external files Data step File (recreate) File with mod option (append) Proc step Proc export (Recreate /add new sheets to an existing file) ODS CSVALL

Writing to external files Data step Proc step SAS File functions

Filename: Assigns a file reference in a data step Fexist: Checks if a file exists. Fopen : opens the file and creates a file handler Fclose : Closes the file that has been opened using the file handler Fput : Writes the information to the file data buffer Fwrite : Writes data from file data buffer to the actual file

Appending information to the bottom of a file Data step: Data _null_; File mod; Set somedsname; Put fields we want; Run; File functions: Data _null_; Rc_open=filename(‘fileref’, “full file name along with path”); if rc_open=0 and fexist(‘fileref’) then do; fid=fopen(‘fileref’, ’a’); putrc=fput(fid, ); writerc=fwrite(fid); closerc=fclose(fid); End; Run;

Advantages of using file functions Verify if the file exists Check if the file is in use Wait until the file is available to use Catch exceptions if data write to a file failed Help work around user locks

Concurrent access of datasets Found in multi user systems Several people trying to access the same file Others might have a file in read mode while somebody else is trying to update the file Methods to address concurrent access : “Assume” That it never happens as in a single user system Try to resolve the lock

Code %macro update_audit_file (name_of_program=, campaign_channel=, result_of_run=&syscc._&sysrc._&sysmsg, name_of_audit_file=); %local user date_of_run ; %let user=%sysget(USERNAME); %let date_of_run=%sysfunc(putn(%sysfunc(datetime()),datetime18.)); %let filerf=update; proc sql noprint; select distinct scan(xpath,-1,'\') into :files separated by '|' from sashelp.vextfl where index(xpath,'.sas')>0; quit; %let rc=%sysfunc(filename(filerf,"&name_of_audit_file")); %put rc=&rc; %if %sysfunc(fexist(&filerf)) %then %do; %let open_rc=%sysfunc(fopen(&filerf,a)); %put &open_rc=; %do %while (&open_rc <= 0 ); %let rc_sleep=%sysfunc(sleep(10)); %put The file being updated is open please close it; %put SAS will try to update it in 10 seconds; %let open_rc=%sysfunc(fopen(&filerf,a)); %end;

%if &open_rc > 0 %then %do; %let log=%sysfunc(getoption(altlog)); %let log_file=%sysfunc(scan(%str(&log),-1,'\')); %let list=%sysfunc(getoption(altprint)); %let list_file=%sysfunc(scan(%str(&list),-1,'\')); %let path=%sysfunc(getoption(sasinitialfolder)); %let put_rc=%sysfunc(fput(&open_rc,%str(&user,&date_of_run,&name_of_campaign,&campaign_channel,&path,&result_ of_run,&log_file,&list_file,&files))); %let write_rc=%sysfunc(fwrite(&open_rc)); %let close_rc=%sysfunc(fclose(&open_rc)); %end; %put &open_rc &close_rc; %end; %else %do; %put the file &filerf does not exist; %put creating file &name_of_audit_file; data _null_; file "&name_of_audit_file"; put 'user,dateofrun,name_of_campaign,campaign_channel,path,result_of_run,log_file,list_file,files'; %put %sysfunc(sysmsg()); %end; %mend update_audit_file; Code Continued….

References SAS on-line documentation in Release Using SAS Functions in Data Steps, Yue Ye, The R.W. Johnson Pharmaceutical Research Institute, Raritan, NJ Yong Lin, The Cancer Institute of New Jersey, New Brunswick, NJ Acknowledgements Vitaly Feldman, SAS Institute Inc.