SAS log: report permanent data sets read / SQL procedure

Reply
Frequent Contributor
Posts: 79

SAS log: report permanent data sets read / SQL procedure

This probably falls into the category of "no" or petition SI.  Does SAS have an option to report whether a data step or procedured read from a (permanent) data set?

 

323 proc sql ;

324 select count( * )

325 from sdtm.dm

326 ;

327 quit ;

NOTE: PROCEDURE SQL used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

 

328

329 data _null_ ;

330 set sdtm.dm nobs = nobs ;

331 put nobs= ;

332 stop ;

333 run ;

nobs=43

NOTE: There were 1 observations read from the data set SDTM.DM.

NOTE: DATA statement used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

 

334

335 data _null_ ;

336 if 0 then set sdtm.dm nobs = nobs ;

337 put nobs= ;

338 stop ;

339 run ;

nobs=43

NOTE: DATA statement used (Total process time):

real time 0.00 seconds

cpu time 0.00 seconds

 

I see no fool proof method of parsing the log to obtain such information unless the NOTE reports it.  Users can use macros and macro variables.

 

I would like to have my programmers report all data sets and files used by a program, but they are not consistent.  Since I perfrom a log check, I thought I would just glean this information from the log, but the SQL procedure and the case when the program uses the metadata but does not read an observation are problematic.  Procedures like MIXED do not seem to report the data set used to the log, but rather to the PRINT destination, which is of no use if the LISTING destination is closed.

 

Thank you,

 

Kevin

Grand Advisor
Posts: 17,428

Re: SAS log: report permanent data sets read / SQL procedure

Use PROC SCAPROC to output a trace of the programs, if all programmers use this the output is standardized and you can write custom scripts to parse the output to your hearts desire. 

 

Plus here's some code to get you started in parsing the output:

http://support.sas.com/kb/58/047.html

 

 

 

 

Respected Advisor
Posts: 3,840

Re: SAS log: report permanent data sets read / SQL procedure

I don't believe there is any fool proof method to achieve what you're after using SAS logs. Example: If you access a view then best you get in the log is the name of the view but not which tables the view accessed.

 

You could use some OS monitoring tool to collect stats which .sas7bdat files get accessed how often

Ask a Question
Discussion stats
  • 2 replies
  • 119 views
  • 0 likes
  • 3 in conversation