Hi,
I have one doubt that suppose I am working in work library.
data a;
set sasuser.admit;
run;
session is not ended yet. So, wanted to know that is there any process which let me know for dataset a which code was run ??
The answer depends on your SAS environment:
In SAS Studio you can just go to CODE window;
In regular SAS status is displayed on top of program ediror window;
in any SAS O/L environment you can look at the LOG window.
In unix environment you can run on xterm the ps -ef | grep sasexe command.
I don't think you can answer a question as: which process created work.a table, except
if you can recall last code submitted until 1st time you find a step creating data a;
One more possibility: you can save the program name in the dataset label,
by: data a(label="created by program...");
If you have saved the program file bebore running then code similar to this:
data work.junk (label=%sysget(SAS_EXECFILENAME));
set sashelp.class;
run;
will put the name of the running program file in the data set label. Which can be viewed in the SAS Explorer data set properties or seen in the description column of explorer.
But nothing much retroactively.
Hi, Thanks for your reply.
As this approach can help you in the current session.
I just want to know suppose I have created permanent dataset in a library say a.
then after I close the sas session. I want to get a previous log or any other info which tell me which code was submitted to create a dataset a ?
Thanks in Advance.
The code I showed above sets the data set label (or description) if you prefer. It will stay with that value until you change it.
There is nothing in SAS I am familiar with that will retroactively do what you you want unless, possibly, you implement a source code management system and reference that for which programs create data sets.
Or use an operating system search tool to look in program files that may reference the data set.
I can think of few ways to save traces of work:
1) you can save the log files, of each run, under name containing a timestamp (date and time) in a dedicated directory
2) you can save a dataset and append a record for each run with any desired information
3) as said before, you can enter upto 240 characters into the dataset label as text, in any format you decide.
You may think of other solutions depending on your environment.
Please don't get me wrong, but I bet you're brazilian, cause you wrote "doubt" instead of "question".
English speakers will be confused, if you say "doubt", "doubt" is when you're skeptical about something, it's a literal translation from portuguese.
I also have this same question, was wondering if it has been satisfactorily answered already.
Way back in the early days of SAS they used to store some code in the SAS dataset. I think you could see it when you ran PROC CONTENTS. I am not sure when it went away. Version 5? Version 6? Not that it was that useful because it would just look something like the data step posted in the original question.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.