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

I have a data from excel and trying to create the SAS dataset to comparison.

As shown in the below, my data starts from cell B5 and B4 is my header. With the below i was able to get the data from row 5 but how can i remove the empty column and assign the header with B4 values.

 

 

/*excel file*/
A B C D E F
1
2
3
4 Subject name address city state
5 101 mary 324 jas NN mm
6 102 second 85 hsd mkas ewe
7 Subject name address city state
8 222 tird 67 hhsbd yes vgdsd
9 558 sdhd 792 djsh kues shdj


%macro impo(path=, in=, out=); %let sfile="\file_path\&in..xlsx"; proc import datafile=&path out=&out. dbms=xlsx replace; sheet=&sheetbou; getnames=yes; datarow=5; run; %mend;
%impo(path=&sfile, in=&inbou, out=&prgm);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JOL
SAS Employee JOL
SAS Employee

If you specify the input RANGE including the header, and set GETNAMES = YES, it will work.

 

JOL_0-1686847094921.png

 

View solution in original post

2 REPLIES 2
JOL
SAS Employee JOL
SAS Employee

If you specify the input RANGE including the header, and set GETNAMES = YES, it will work.

 

JOL_0-1686847094921.png

 

Reeza
Super User

Not sure if this works in import but if you leave 0 as the end of the range, it will automatically take the full range. 

Worth a try at least.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 961 views
  • 0 likes
  • 3 in conversation