Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

solutions with the EXCEL LINAME engine SAS 1

Status
Not open for further replies.

charisi

Technical User
May 25, 2009
9
AU
iam trying to transfer multiple 4 spreadsheets from Excel to SAS format and then merge the respectivefour tables into one dataset on SAS. how do i get an output as i go through the data steps . i would prefer this realtime out put to autosave .i do not want to autosave. please tell me how to activate my libname engine and make use of it?
you can see iam a novice with SAS
obtaining multiple excel sheets and merging the data( four tables) into one data. how does one do this?what is the relevant code for multiple excel sheets thenmerging these onto one SAS dataset?
thanks
 
There are several ways that you can do this. If you know the name of the sheets in advance than why not have a PROC IMPORT run 4 times.

Code:
proc import
   datafile="yourxlsfilename.xls"
   out     = yourdataset1;
   GETNAMES=yes;
   SHEET="yoursheet_name";
RUN;
proc import
   datafile="yourxlsfilename.xls"
   out     = yourdataset2;
   GETNAMES=yes;
   SHEET="yoursheet_name";
RUN;

proc import
   datafile="yourxlsfilename.xls"
   out     = yourdataset3;
   GETNAMES=yes;
   SHEET="yoursheet_name";
RUN;

proc import
   datafile="yourxlsfilename.xls"
   out     = yourdataset4;
   GETNAMES=yes;
   SHEET="yoursheet_name";
RUN;


data final;
  set yourdataset1
      yourdataset2
      yourdataset3
      yourdataset4;
run;

Now if you want to get fancy there is an paper that can direct you how to dynamically get the sheet name information.


Klaz
 
thank you for your response Klaz2002 , most appreciated it clarifies lots of things.most appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top