Import first 20 records of excel to SAS

sas
load

#1

In my excel file, there is 200,000 observations, While importing I do not want to import all observations. I want to import first 20 observations only. How can I perform this in Base SAS?


#2

First import the file into sas environment and then apply option of (obs=20).
hope answered the question.


#3

Steve,

You can use range option in PROC IMPORT. Like Here i have used to read first two records with heading.

Proc Import out=Test datafile=“D:\Desktop\IMP.XLS” ;
Range= “A1:B3”;
Run;

thx


#4

thank u imran!
as im new to sas im only aware of the options in subsetting the dataset.
i’ve got another question that, im unable to import file in “xlsx” format which is of 2007 excel format.how to deal with that, any other option do i have to mention over there in proc import?


#5

@zubairsahil

Which version of Base SAS are you using?

Regards,
Sunil


#6

im working with SAS 9.1 version.


#7

@zubairsahil

Actually, I would recommend that you check the Tech Support area. I believe that XLSX files could NOT be imported until SAS 9.2.

Regards,
Sunil


#8

yeah… thank you sir for the info…
actually im into clinical domain sas programming…i have onli 9.1 version, if u have any link to download the above version 9.2 can u plz share with me.