@Nipun22 wrote:
sasuser library was writable in earlier times?
The SASUSER library is writable now if you choose to start SAS with the NORSASUSER option. But if you are using some tool like Enterprise Guide or SAS/Studio to start your SAS sessions then that decision was made by whoever setup your application servers.
So it seems SAS will make the dataset(s) specified in the DATA statement (but not replace an existing one) even if the code causes a compile time error.
So the answer to the WHY? question is that SAS made a poor design decision early on and has kept it for compatibility reasons.
So a poorly designed question. They could have gotten to point across better by just using different member names.
Perhaps they wanted to trick you by using the same member name? If so then they tricked themselves because if you had set the system option USER to the value SASUSER then the step would run and write one observation. Because in that case the single name ONE means SASUSER.ONE instead of the normal WORK.ONE. So the OUTPUT statement is writing to the a dataset name in DATA statement.
You can see this by changing the value of the USER option, but if you session started with USER set to SASUSER you would not need the option statement.
1 options user=sasuser; 2 data sasuser.one; 3 x=1;y=2; 4 output one; 5 run; NOTE: The data set SASUSER.ONE has 1 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
And note that it does not seem to be an EXECUTION time error. The issue is not caused by executing the OUTPUT statement. You see that by making the output statement conditional. There must be some grey area between compile time and actual execution that it is actually failing at.
1 data sasuser.one; 2 x=1;y=2; 3 if 1=0 then output one; --- 455 ERROR 455-185: Data set was not specified on the DATA statement. 4 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set SASUSER.ONE may be incomplete. When this step was stopped there were 0 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Re: your side note from@Tom :
And note that it does not seem to be an EXECUTION time error. The issue is not caused by executing the OUTPUT statement. You see that by making the output statement conditional. There must be some grey area between compile time and actual execution that it is actually failing at.
1 data sasuser.one; 2 x=1;y=2; 3 if 1=0 then output one; --- 455 ERROR 455-185: Data set was not specified on the DATA statement. 4 run; NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set SASUSER.ONE may be incomplete. When this step was stopped there were 0 observations and 2 variables. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
I think the step is failing at compile time. But also earlier in the compile time, SAS apparently creates the output datasets listed on the DATA statement.
What is actually created at compile time is the temporary .sas7bdat.lck file. And this file is renamed to .sas7bdat when the step terminates even in case of ERROR if no previous dataset exists.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.