BookmarkSubscribeRSS Feed
Arumugam
Calcite | Level 5

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;

4 REPLIES 4
DF
Fluorite | Level 6 DF
Fluorite | Level 6

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!

art297
Opal | Level 21

However, the behavior that DF describes can be controlled.  Take a look at: http://support.sas.com/techsup/technote/ts250.html

DF
Fluorite | Level 6 DF
Fluorite | Level 6

Ah - thanks Art!  I always forget about Modify and Update...

Arumugam
Calcite | Level 5

Thanks DJ / Art.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

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.

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
  • 4 replies
  • 867 views
  • 0 likes
  • 3 in conversation