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

Hello SAS community,

 

i observed that despite suceesfully creating a permanent library for my dataset (the file gets saved in it too), when i work with the dataset e.g keep only some variables, my new dataset gets stored in the work folder and not my permanent library. What can i do please?

this is the program i used to create a new library

 

*CONVERTING MEPS DATA TO SAS FORMAT;
LIBNAME WEEK2 'C:\Users\HP SPECTRE\Documents\My SAS work\MEPS15';
FILENAME HI81 'C:\Users\HP SPECTRE\Documents\My SAS work\H181SSP\H181.SSP';
PROC XCOPY IN=HI81 OUT=WEEK2 IMPORT;
RUN;

 

after this,  the data H181 appears in my WEEK2 folder in SAS but if i work on the file

 

e.g keep so variables 

 

DATA KEEP;
SET WEEK2.H181;
KEEP dupersid age15x sex region15 racethx cpsfamid famid15;
RUN;

 

the output is saved in my work folder not the WEEK2 library, this is the log:

 

DATA KEEP;
548 SET WEEK2.H181;
549 KEEP dupersid age15x sex region15 racethx cpsfamid famid15;
550 RUN;

NOTE: There were 35427 observations read from the data set WEEK2.H181.
NOTE: The data set WORK.KEEP has 35427 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.51 seconds
cpu time 0.37 seconds

 

i expect that it should get saved in the WEEK2 library i created, not the work folder.

 

can anyone please help with this?
thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Right-click on the app icon, and select Properties. Then you can see the complete command used to start the SAS session.

Usually, this command has a -autoexec option that contains the path to the autoexec.sas file, where you can insert the statement.

View solution in original post

13 REPLIES 13
PaigeMiller
Diamond | Level 26

To save a data set in the WEEK2 library, you need to use a two-part name, with WEEK2. as the first part.

 

So you want to start the DATA step with

 

DATA WEEK2.KEEP;

 

 

--
Paige Miller
Banke
Pyrite | Level 9

thank you, it worked 

however when i closed the SAS session and reopened my folder was no longer there.

can you please share a simple SAS program to save a large excel file permanently?

thanks 

Kurt_Bremser
Super User

You need to run the LIBNAME statement every time you started a new SAS session.

To avoid this, you need to include the LIBNAME in your autoexec (autoexec code in Enterprise Guide or SAS Studio, or autoexec.sas file of the SAS installation itself).

Banke
Pyrite | Level 9

Thanks, how can i do this please? include the libname in autoexec.sas file of the SAS installation itself?

Kurt_Bremser
Super User

Where you put it depends on the way you use SAS.

Is it a single-workstation setup on Windows, or a client-server setup?

If the latter, how do you access it, with Enterprise Guide or SAS Studio?

 

And it is impirtant to know the scope where the library should be available. All users, or just you? And for just a single project, or every time SAS is used?

Banke
Pyrite | Level 9

 

 it is a single-workstation setup on Windows, i installed it. my university has the license

 i work directly on it. i have attached a snapshot of the interface. i am not sure whether it is studio or enterprise guide

i am the only user and i use it for my class projects

 

 

Kurt_Bremser
Super User

You would know if you used Enterprise Guide, because you would start that application, not SAS itself.

So I take it you use the native Display Manager UI, and simply start SAS 9.4.

You can locate the autoexec.sas file in the SAS installation directory and insert the LIBNAME statement there.

Banke
Pyrite | Level 9

Thank you. this is what my interface looks likeScreenshot (315).png

Kurt_Bremser
Super User

Right-click on the app icon, and select Properties. Then you can see the complete command used to start the SAS session.

Usually, this command has a -autoexec option that contains the path to the autoexec.sas file, where you can insert the statement.

Banke
Pyrite | Level 9
MY APP IS SAS 9.4 (UNICODE SUPPORT)
SASKiwi
PROC Star

You are using the SAS Windowing Environment, not SAS Enterprise Guide or SAS Studio.

Banke
Pyrite | Level 9

is SAS studio or enterprise easier to use? i am a new SAS user and encountering lots of issues

Kurt_Bremser
Super User

If Enterprise Guide is included in your package, I would use it. The wizards for most procedures are quite handy to explore the procedures. It also allows selective "autoexec" code (sent before every submission, when a project is opened, or when a connection to a SAS process is established).

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 13 replies
  • 1889 views
  • 1 like
  • 4 in conversation