BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9

tianerhu_1-1655762292071.png

I want to instead of A B C to Name Height Weight ?  Thank you .

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

If you are reading from an actual EXCEL file (an XLSX file or even an old style XLS file) then use the RANGE option on PROC IMPORT.  For that example tell it the range starts in A3 instead of the default of A1.

proc import datafile='myfile.xlxs' dbms=xlsx out=want replace ;
  range='$A3:' ;
run;

Example you can use to test:

filename x temp;
proc export data=sashelp.class file=x dbms=xlsx replace;
run;
proc import datafile=x out=want replace dbms=xlsx;
  range='$A2:';
run;

proc print data=sashelp.class(obs=2); run;
proc print data=want(obs=1); run;

Results:

Tom_0-1655764445176.png

 

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

If you are reading from an actual EXCEL file (an XLSX file or even an old style XLS file) then use the RANGE option on PROC IMPORT.  For that example tell it the range starts in A3 instead of the default of A1.

proc import datafile='myfile.xlxs' dbms=xlsx out=want replace ;
  range='$A3:' ;
run;

Example you can use to test:

filename x temp;
proc export data=sashelp.class file=x dbms=xlsx replace;
run;
proc import datafile=x out=want replace dbms=xlsx;
  range='$A2:';
run;

proc print data=sashelp.class(obs=2); run;
proc print data=want(obs=1); run;

Results:

Tom_0-1655764445176.png

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 338 views
  • 0 likes
  • 2 in conversation