proc import out= df
datafile = 'df.xlsx'
dbms = xlsx
replace;
getnames=no;
datarow=2;
run;
Excel file
my varibles names not properly display
column name is epd year vc code
Can you show us the results as seen in SAS (not Excel)?
Can you show us the PROC IMPORT code you used?
Also, can you explain in more detail what is wrong?
SAS output
epd year vc code is my column name i want
@Daily1 wrote:
SAS output
epd year vc code is my column name i want
I don't understand what the problem is. Your variable names shown are epd year vc code. Please explain further.
brother just i want this type of output
I'm not understanding. You need to EXPLAIN. Do not write one brief sentence that repeats what you have already said; you need to provide new information, explaining what you want in detail so I can understand what the issue is. At no point have you explained your problem with the variable names.
Your data starts in A2 instead of A1. You need to tell PROC IMPORT to do the same.
proc import out= df replace
datafile = 'df.xlsx' dbms = xlsx
;
range='$A2:';
run;
%macro pim(sheet);
proc import out= df.&sheet replace
datafile = 'df.xlsx' dbms = xlsx ;
range='&sheet$A2:';
run;
%mend pim;
%pim(A);
A is a sheet1 name
SAS log error
Couldn't find sheet in spreadsheet
Requested Input File Is Invalid
ERROR: Import unsuccessful. See SAS Log for details.
how to import multiple sheets using Proc Import.
Single quotes prevent macro variables from being resolved.
And this can not work:
out= df_'&sheet'
Dataset names must not contain quotes.
Two issues:
Your column names are in row 2, so you must use a range (see @Tom 's post). Alernatively, you can remove row 1 from the spreadsheet before importing it.
And your GETNAMES=NO statement explicitly prevents SAS from retrieving the variable names from the spreadsheet, so don't be surprised when SAS does what it is told to do.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.