BookmarkSubscribeRSS Feed
My_SAS
Calcite | Level 5

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.

2 REPLIES 2
Linlin
Lapis Lazuli | Level 10

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

PGStats
Opal | Level 21

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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