BookmarkSubscribeRSS Feed
Chery
Obsidian | Level 7

Hi ,

 

Can any one help me with below requirement.

 

1. Want to read sas log resides on unix environment through EG

2. Capture the activity what datasets they reading, from which source, finally what they are doing ( kind of monitoring user activity)

3. Finally provide the captured information.

 

Please provide some sample code for this.

2 REPLIES 2
Kurt_Bremser
Super User

Finding datasets that were written or read is rather easy, as the NOTEs always look the same and the lines containing them can be easily extracted by using the INDEX() function with the proper substrings. To determine those substrings, read a log file, it's pretty obvious.

So that is just reading a text file (use _infile_ to get the whole input buffer) and a subsetting if with the proper strings, then doing substr() to get the dataset name out of the line. Set an additional parameter containing a read/write flag, and add the logfile or program or user name as appropriate.

Then you have one observation for every dataset that was read or created.

 

Extracting what in particular was done is non-trivial, as it basically involves parsing the preceding step(s). Talk about writing a code parser in SAS itself.

 

I'd rather be content with the dataset information. Further determination of what was done in particular I'd rather leave to the good old eyeballs Mk I.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Sorry, this is not a contract work forum.  If you have specific questions then we can ask that, but a logcheck application is not within the confines of this forums remit.

 

As for your points there:

1) To read a file use the infile syntax, plenty of examples given in the SAS documentation.

2) This can go from simple to extremely complicated in a few lines of code.  How are you controlling what coders write?  I can write some very complicated macro/generated code which it would takes days to untangle, how would you capture that in your app?

3) Far to vague a question, "provide" - how, in what format - try proc print/report, or tagsets.excelxp.

 

Simply put, this task can be very large depending on how well controlled the inputs are.  For instance, if you tell your programmers to follow a fixed methodology, 1 step one dataset named dsX, then its quite simple.  If your analyzing complexe programs where output could be streamed around, files read, code generated, ods objects selected etc. then it becomes vastly more complicated - perhaps a step to far if you cannot currently read in a log file from Unix?

 

A further thought, since 9.2 there have been some tools provided by SAS to achieve simliar things to this, proc scaproc is used and that can help, here is a paper on it:

http://www2.sas.com/proceedings/forum2008/006-2008.pdf

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1377 views
  • 3 likes
  • 3 in conversation