BookmarkSubscribeRSS Feed
ybz12003
Rhodochrosite | Level 12

Hello:

 

I got an error message by use 'guessingrows' in proc import 'xlsx'.  I would like to make sure the length of the cell is long engouth to hold the words,  how to fix it?  Please help.  Thanks.

 

proc import out=NC

datafile='\\abc\monthly_data\Test\Report2017.xlsx'

dbms=xlsx replace;

sheet=variables;

getnames=yes;

datarow=2;

guessingrows=159503;

run;

quit;

 

 

75 proc import out=NC

76 datafile='\\abc\monthly_data\Test\Report2017.xlsx'

77 dbms=xlsx replace;

NOTE: The previous statement has been deleted.

78 sheet=variables;

79 getnames=yes;

80 datarow=2;

81 guessingrows=159503;

     ------------

     180

     ERROR 180-322: Statement is not valid or it is used out of proper order.

82 run;

 

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE IMPORT used (Total process time):

real time 0.01 seconds

cpu time 0.03 seconds

83 quit;

 

4 REPLIES 4
Reeza
Super User

GUESSINGROWS is not a valid option for DBMS=XLSX. 

 

Excel is not a database and doesn't enforce types. 

You can try DBSASTYPE to force a type, but my suggestion would be to create a CSV file and import that. 

ybz12003
Rhodochrosite | Level 12

So is there a way to use XLXS cause I have multiple sheets.

Patrick
Opal | Level 21

@ybz12003

I believe the XLSX engine does the guessingrow bit implicitly and always analysis all rows.

I've just run a test with the first 1 million rows in column A having a value of "a" and row 1000001 having a value of 'bbbbb'. The length of the variable in the SAS table was 5 and no source values got truncated.

 

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
  • 4 replies
  • 20173 views
  • 7 likes
  • 3 in conversation