BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
kiran_reddy
Calcite | Level 5

Hi all could please help for below question,

 

I have a .xlsb file containing one lakh records in that few of the records of a particular variable has above 500 characters  towards bottom of the file, but i could read only up to 250 characters using proc import, how do I read the complete 500 characters?

 

In simple terms the how to increase the length of the particular record up to 500?

I have tried SCANTEXT, GETNAMES, but nothing worked. Please help me.

 

Sample program which I have tried.

 

proc import datafile=work.abc DBMS=excelcs replace out="C:\Users\work\Desktop\abc.xlsb";

sheet='Repayment';

getnames="yes";

scantext="yes";

run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
SuryaKiran
Meteorite | Level 14

Proc Import by default scans first 20 rows to identify the maximum variable width. Try  GUESSINGROWS=MAX. The maximum value for the GUESSINGROWS= statement for PROC IMPORT when reading a comma, tab, or delimited file is 2147483647 (SAS 9.4)

Thanks,
Suryakiran

View solution in original post

5 REPLIES 5
Kurt_Bremser
Super User

Save to a sensible format like csv from Excel and read the resulting text file with a SAS data step where you can set attributes as needed. With Excel files, you are forced to live with the guesses proc import makes.

kiran_reddy
Calcite | Level 5

Hi Kurt, I am tried to convert the file to csv and another formats but the problem is the file is saved in the server and mostly that file updated every day. So that's the reason we can't able to convert that file.

thanks 

Kurt_Bremser
Super User

@kiran_reddy wrote:

Hi Kurt, I am tried to convert the file to csv and another formats but the problem is the file is saved in the server and mostly that file updated every day. So that's the reason we can't able to convert that file.

thanks 


It's absolutely easy to select "save as" when writing the file, so that's no argument at all.

SuryaKiran
Meteorite | Level 14

Proc Import by default scans first 20 rows to identify the maximum variable width. Try  GUESSINGROWS=MAX. The maximum value for the GUESSINGROWS= statement for PROC IMPORT when reading a comma, tab, or delimited file is 2147483647 (SAS 9.4)

Thanks,
Suryakiran
kiran_reddy
Calcite | Level 5

Thanks for your replay.

 

I will try and let me know if it's working or not, thanks surya

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