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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

import from Excel with renaming columns and adding some leading zeroes

Status
Not open for further replies.

RinaGreen

Technical User
Mar 8, 2005
31
0
0
US
Hi

I need to import file from Excel to SAS and to rename all fields. Actually I already imported file from Access ones.

I assume it should be like the following....I assume I just need to put FILE instead TABLE (in Access). Also I assume I need

to specify a sheet....

I am not sure how to rename columns names in Excel in order tem to be consistent in SAS...I tried to use help on-line . Below

is what I assume...

Also...some of my member id in excel do not have leading zeroes which I need if member id is less then 9 digits (for ex I

need 012345678 instead 12345678). I assume I need to use FORMAT function? In what way?


Thank you very much in advance

Rina
*******************************************************************************

libname mylib 'c:\myDir\rina\myFolder\SAS Datasets';

*** InTbl: Name of Sheet in Excel worksheet to be imported;
*** SASTbl: Name of SAS output data set;
*** InFl: Complete path and name (with .xls extension) of Excel file to be imported;

proc import file='sheet1'
out=myOutput
dbms=excel;
workgpdb='myGrp';

RENAME MEMBER_ID = MEMBER ID
NUMBERS_OF_VISITS=# OF VISITS
MEMBER_REFFERED=HAS MEMBER BEEN REFFERED;


file='c:\myDir\rina\myFolder\myFile 'v2000.xls';
userid='rina';
password=' ';
workgpdb='myGrp';
run;
 
Sorry, I mistakenly posted in a wrong part (imstead SAS)!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top