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

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:

NOTE: WORK.myworkfile data set was successfully created.
NOTE: The data set WORK.STUDYFILES has 879 observations and 12 variables.
 
when I run the same code from the new program file I get the following log:
USER.STUDYFILES data set was successfully created.
NOTE: The data set USER.STUDYFILES has 879 observations and 12 variables.

 

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;
 

View solution in original post

5 REPLIES 5
gabyelle
Obsidian | Level 7

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!

Reeza
Super User

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. 

 

 

gabyelle
Obsidian | Level 7

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

Tom
Super User Tom
Super User

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;
 
gabyelle
Obsidian | Level 7

Thank you - that makes completely sense!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

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
  • 5 replies
  • 838 views
  • 1 like
  • 3 in conversation