DATA Step, Macro, Functions and more

Import Excel file from 6 th Row

Reply
Contributor
Posts: 37

Import Excel file from 6 th Row

Hi i am getting excel file but i should read from 6 th row(In 6 th row i am having the variables).The variables have space in between them how can i do it.

I have atttached the sample Excel file.

Super Contributor
Posts: 1,636

Re: Import Excel file from 6 th Row

Hi,

I saved your file as a .xls file then ran the code below:

proc import datafile="c:\temp\test_data.xls"

                        dbms=xls

                        out=DataSet

                        replace

                        ;

        sheet="Sheet1";

        getnames=no;

        datarow=7;

run;

proc print;run;

Obs              A                    B

1              12                   23

2              34                   67

3              56                   78

Linlin

Respected Advisor
Posts: 4,930

Re: Import Excel file from 6 th Row

Or if you want to read in the column titles, one way is like this :

libname xl excel "&SASForum.\datasets\test_data.xlsx";

proc print data=xl.'Sheet1$A6:B99'n; run;

                                                           date_of_

                                               emp_num_    join_in_

                                        Obs       det       the_org

                                          1       12          23

                                          2       34          67

                                          3       56          78



 


 


 


 


 


 


 


 


 


 


 


 


PG
Ask a Question
Discussion stats
  • 2 replies
  • 9048 views
  • 0 likes
  • 3 in conversation