Greetings to the SAS Studio saviours out there! Hope someone can help out.
I thought I was just starting to get the hang of SAS Studio but got stumped by something probably trivial but that I can't figure out!!
I have used the following proc import code to import a dataset:
proc import datafile="/folders/myfolders/myfile.CSV"
OUT=myworkfile
DBMS=CSV
REPLACE;
RUN;
this code was in a program file containing other code but I only highlighted the code above and hit the run button, e.g. without running anything else.
I had previously used the libname statement in that program file to create the library STUDYFILES.
Trying to tidy things up, I created a separate program file to copy and paste the successful code into, but re-running the exact same code from the new program file, I don't get the output data tab and I discovered the file output to WEBWORK.
the code I get when I get the output data is logged as follows:
Can anyone explain what is happening? Is it to do with the fact that if there are two programs I am trying to use then they can't both output to work if the code is the same?
Thanks in advance guys.
Normally when you use a one level name SAS will take it to mean a dataset in the WORK libref.
But if you have defined a USER libref then SAS will treat that one level name as being in the USER libref.
So whatever you did to change your sessions settings has made SAS think that you want to use USER instead of WORK for one level names.
If you want to force it to always write to the WORK libref then use a two level name.
proc import datafile="/folders/myfolders/myfile.CSV"
OUT=WORK.myworkfile replace
DBMS=CSV
;
RUN;
I may have made progress on this - I found the SAS Studio User Guide (version 4.2) and found out that if I swich the interactive mode OFF (I forgot I had it on to avoid overwriting log), then the results are stored in WORK and not WEBWORK.
However, also the original program file that stored data into WORK is set to be in interactive mode.
I wonder if using interactive mode is good for a beginner after all - I was reading that it keeps the code in memory until a new PROC or a data step are used . That might explain why I thought SAS Studio was having me on - perhaps best to switch if off until I am in the learning phase?
Suggestions/ comment from experienced folks would be great!
I find interactive mode easier to work with but there are some best practices to help make this better. It's good that you found the error, and working in multiple modes may be a bit confusing but knowing the difference is also a good idea. In the long run you'll be a better programmer. That being said, use the method that will be used most frequently when you're 'fully trained'. If that's batch processing then go with that.
Hi Reeza
thanks for your reply. Basically using interactive mode is best when you are more experinced as you may not reaize how many actions you set in motion whilst you are busy trying to figure things out?
Would you then recommend beginners not use the interactive mode until they are confident of having mastered all the basic skills?
I will look up batch processing 🙂
Thanks again
Normally when you use a one level name SAS will take it to mean a dataset in the WORK libref.
But if you have defined a USER libref then SAS will treat that one level name as being in the USER libref.
So whatever you did to change your sessions settings has made SAS think that you want to use USER instead of WORK for one level names.
If you want to force it to always write to the WORK libref then use a two level name.
proc import datafile="/folders/myfolders/myfile.CSV"
OUT=WORK.myworkfile replace
DBMS=CSV
;
RUN;
Thank you - that makes completely sense!
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.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.