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??
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
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:
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.