BookmarkSubscribeRSS Feed
GreggB
Pyrite | Level 9

Here's my step:

proc import datafile="G:\Departments\Research\test scores\SCREADY\&prevyr.-&yr.\&yr.SCREADY.xlsx" out=state dbms=xlsx replace;
sheet="&yr SC READY STATE";
range="A1:BS97";
run;

I'm also getting columns BT through DL, which I don't want.

 

5 REPLIES 5
Shmuel
Garnet | Level 18

I'm not sure but you may try:

 

libname mydata xlsx "G:\Departments\Research\test scores\SCREADY\&prevyr.-&yr.\&yr.SCREADY.xlsx";

 

proc import datafile=mydata;
sheet="&yr SC READY STATE";
range="A1:BS97";
run;

Arpit_Agarwal
Fluorite | Level 6

Try this -

 

proc import datafile="C:\TESTFILE.xlsx" out=testme dbms=excel replace;

getnames=yes;

range='A1:BS27'; /*I set to 27, as I just had to make a sample sheet to test what's not working for you*/

run;

 

 

ShajiVijayan
Calcite | Level 5
This is a very old thread.. But I wish to answer it incase anyone comes here looking for the answer:

the coding will be

proc import datafile = 'the path of the file'
out = name of the dataset you wish to have
dbms = xls or xlsx depending on the file extension
range = 'sheet name $ and the range';
run;

As per your data and file path the coding will be:

proc import datafile="G:\Departments\Research\test scores\SCREADY\&prevyr.-&yr.\&yr.SCREADY.xlsx"
out=state
dbms=xlsx replace;
range="&yr SC READY STATE$ A1:BS97";
run;

Hope this helps
deedee07
Calcite | Level 5

Hi, what if we have different no of data on monthly basis? Is there any other ways to not hard coded the range while working with the same file but having different no of data? 

Thanks

kpberger
Obsidian | Level 7

Yes, you can set the range to

range="A3:0";

if you want to start reading in data from the third row and capture all rows and columns with data regardless of how many there are.

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 22142 views
  • 1 like
  • 6 in conversation