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

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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