Help using Base SAS procedures

Please help me below question

Accepted Solution Solved
Reply
New Contributor
Posts: 4
Accepted Solution

Please help me below question

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;

 


Accepted Solutions
Solution
‎03-26-2018 01:33 PM
Valued Guide
Posts: 597

Re: Please help me below question

Posted in reply to kiran_reddy

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


All Replies
Super User
Posts: 10,280

Re: Please help me below question

Posted in reply to kiran_reddy

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
New Contributor
Posts: 4

Re: Please help me below question

Posted in reply to KurtBremser

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 

Super User
Posts: 10,280

Re: Please help me below question

Posted in reply to kiran_reddy

@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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Solution
‎03-26-2018 01:33 PM
Valued Guide
Posts: 597

Re: Please help me below question

Posted in reply to kiran_reddy

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
New Contributor
Posts: 4

Re: Please help me below question

Posted in reply to SuryaKiran

Thanks for your replay.

 

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 169 views
  • 0 likes
  • 3 in conversation