DATA Step, Macro, Functions and more

importing .xls in SAS PERMANENTLY

Reply
N/A
Posts: 0

importing .xls in SAS PERMANENTLY

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
SAS Super FREQ
Posts: 8,868

Re: importing .xls in SAS PERMANENTLY

Posted in reply to deleted_user
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
Ask a Question
Discussion stats
  • 1 reply
  • 102 views
  • 0 likes
  • 2 in conversation