Hi,
I am new to SAS.I saw same dataset is referenced for both input and output.I want to understand what happens in the background.How sas handles the same sas dataset as input and output?
Sample code:
data temp;
set temp;
run;
Basically, it starts off by reading in from the original dataset, but outputting to a temporary file. In your example this would be called "code.lck" and should appear in the same folder as the rest of your datasets (e.g. your WORK library).
Once the process is finished, assuming there were no errors, SAS deletes the original file (code.sas7bdat) and renames the temporary file to replace the original.
The same process happens when creating a new dataset for the first time, or overwriting an old one. E.g.
data one;
set two;
run;
The "one.lck" file is created first, and if it already exists "one.sas7bdat" is deleted once the code finishes running.
If you're running code that takes long enough, you can see these files being created/deleted.
Hope that helps!
However, the behavior that DF describes can be controlled. Take a look at: http://support.sas.com/techsup/technote/ts250.html
Ah - thanks Art! I always forget about Modify and Update...
Thanks DJ / Art.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.