BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi ,

I've an execl file ' laptop_review.xls' and want to import in SAS Permanently in 'C' .

i used a code :

libname dis "C:\Cwa";
PROC IMPORT OUT= WORK.sales1
DATAFILE= "C:\laptop_review.xls"
DBMS=EXCEL REPLACE;
SHEET="review";
GETNAMES=YES;
MIXED=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc print data=sales1;
run;

it works in the SAS windows but its not created permanently in 'C'

Kind regards
markc
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
You have asked this same question many times already, and the fact that you are asking again implies that you have not read any of the suggested documentation on the topic of temporary vs permanent SAS libraries.
You have EXPLICITLY coded:
[pre]
OUT=WORK.sales1
[/pre]

...which means that the file will only live in the WORK library during your SAS session and will go away when the SAS session is over.

You have a LIBNAME statement in your code:
[pre]
libname dis "C:\Cwa";
[/pre]

this means that
[pre]
OUT=DIS.sales1
[/pre]

...would cause the dataset to be written to the physical location:
c:\Cwa\sales1.sas7bdat (which is how the dataset looks in Windows Explorer).

The reference DIS.SALES1 is the proper TWO-LEVEL name for a permanent SAS dataset, as described in my previous answer to this same question in this post:
http://support.sas.com/forums/thread.jspa?messageID=32427纫

Other folks have also explained how to save a dataset permanently in response to this same and related questions in these postings:
http://support.sas.com/forums/thread.jspa?messageID=32418红
http://support.sas.com/forums/thread.jspa?messageID=32344繘
http://support.sas.com/forums/thread.jspa?messageID=32368繰

I still suggest that you read some of the documentation about SAS datasets and the concepts of a SAS library -- both permanent and temporary.
http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a000086013.htm
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002316278.htm
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000986902.htm
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000930616.htm
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a002316280.htm
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000998603.htm

Understanding how a SAS LIBNAME statement works and understanding the difference between WORK and permanent SAS libraries and how to use LIBREFs is fundamental knowledge --
you will not be successful in your SAS programming endeavors without taking the time to really understand these concepts.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1021 views
  • 0 likes
  • 2 in conversation