Import first 20 records of excel to SAS

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?

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


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”;


1 Like

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 to deal with that, any other option do i have to mention over there in proc import?


Which version of Base SAS are you using?


im working with SAS 9.1 version.


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


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.

© Copyright 2013-2019 Analytics Vidhya