BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
cookie111
Calcite | Level 5

I have entered several problems into SAS Studio today.  My current problem is that I have entered my code for a new problem with a new data set and the output results are using the data set from a previous problem from earlier today.  I have even attempted to re-write the code in a new program and the same data set from earlier in the day is still being used on when the new data set should be running.  

This has not happened previous to the update conducted yesterday.  

Any suggestions??

1 ACCEPTED SOLUTION

Accepted Solutions
jimbarbour
Meteorite | Level 14

Check your Libnames very carefully in each place they are used, step by step.  Recall also that if no Libname is specified, WORK is used. 

For example, in the below code, note how there is no Libname specified in the DATA step.  When the step runs, it will create a dataset, but it will be in the WORK library.  Then, when the Proc Print runs, it will print from the previously created Perm_Lib version of the data set which could be hours, days, or even weeks old.  

 

DATA  My_Data;
     *Amazing SAS code goes here.;
RUN;

PROC PRINT DATA=Perm_Lib.My_Data;
RUN;

To correct the issue and get the most current data, you would either need to add a Libname to the DATA step or delete the Libname from the Proc Print.  Something like this:

DATA  Perm_Lib.My_Data;
     *Amazing SAS code goes here.;
RUN;

PROC PRINT DATA=Perm_Lib.My_Data;
RUN;

For this reason, I make it my practice to always code the WORK libname so that it's clear exactly which version of a dataset I'm looking at.

 

Hope that helps,

 

Jim

 

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

Please post the whole log of the step(s) that give(s) you trouble. Copy/paste the log as is into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

jimbarbour
Meteorite | Level 14

Check your Libnames very carefully in each place they are used, step by step.  Recall also that if no Libname is specified, WORK is used. 

For example, in the below code, note how there is no Libname specified in the DATA step.  When the step runs, it will create a dataset, but it will be in the WORK library.  Then, when the Proc Print runs, it will print from the previously created Perm_Lib version of the data set which could be hours, days, or even weeks old.  

 

DATA  My_Data;
     *Amazing SAS code goes here.;
RUN;

PROC PRINT DATA=Perm_Lib.My_Data;
RUN;

To correct the issue and get the most current data, you would either need to add a Libname to the DATA step or delete the Libname from the Proc Print.  Something like this:

DATA  Perm_Lib.My_Data;
     *Amazing SAS code goes here.;
RUN;

PROC PRINT DATA=Perm_Lib.My_Data;
RUN;

For this reason, I make it my practice to always code the WORK libname so that it's clear exactly which version of a dataset I'm looking at.

 

Hope that helps,

 

Jim

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 569 views
  • 0 likes
  • 3 in conversation