BookmarkSubscribeRSS Feed
HeatherNewton
Quartz | Level 8
data monthly.apple_20230630;
infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F;
input @002 account_no $29.
etc

when I run it says quoted string currently being processed has become more thatn 262 bytes long

Is this due to file name with '.' inside? how can I change it so it can read?

does using ' instead of " in infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F;

helps?

 

 

7 REPLIES 7
mkeintz
PROC Star

This suggests to me that there is an unmatched double quote earlier in your program.  If that is the case, then when the first double quote in the INFILE statement is encountered, it is considered as a match for that preceding quote, which is apparently more than 262 characters earlier in your code.

 

Check the code preceding the INFILE statement for unmatched quotes.

 

And make sure you restart the SAS session before you submit the corrected code.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
HeatherNewton
Quartz | Level 8
infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F; 

ignoring double quote problem

how about this filename, could it be read inside single or double quotation mark in infile statement? 

Tom
Super User Tom
Super User

@HeatherNewton wrote:
infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F; 

ignoring double quote problem

how about this filename, could it be read inside single or double quotation mark in infile statement? 


Yes.

You can use either single quotes to set the boundaries of the string literal. Or double quotes. 

 

If there happens to be one of the boundary characters in the actual name then double it up.

 

So you could use either of these lines 

infile '/don''t use names like this.dat'  truncover lrecl=138 recfm=F; 
infile "/don't use names like this.dat"  truncover lrecl=138 recfm=F; 
HeatherNewton
Quartz | Level 8

now I confirmed it is reading fine from infile
but I dont manage to output to the output dataset after the transformation in the datastep, please check for me if this line in the data step is fine too

 

point=index(tmp01,'monthly.apple.20231130');

is this line going to run ok

 

my problem is after the log tells me the infile reads ok

it shows me the output dataset is empty

and it also shows no problem in the transformation

it looks like it cannot write to the output dataset because I am sure it shouldnt be empty

Tom
Super User Tom
Super User

Did you post a complete data step before?

Anyway this line looks fine by itself.

point=index(tmp01,'monthly.apple.20231130');

That is an assignment statement.  It will find where in the character variable TMP01 the string 'month.apple.20231130' starts and returns that position number to the variable POINT. If the substring is not found it will return a position of 0.

 

So TMP01 should be an existing character variable.  POINT should be numeric and will be if it was not previously defined as character by something earlier in the data step.

Quentin
Super User

@HeatherNewton wrote:
data monthly.apple_20230630;
infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F;
input @002 account_no $29.
etc

when I run it says quoted string currently being processed has become more thatn 262 bytes long

Is this due to file name with '.' inside? how can I change it so it can read?

does using ' instead of " in infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F;

helps?

 

 


If you start a new session and run:

data monthly.apple_20230630;
  infile "/boccc/interface/monthly.apple.20230630" truncover lrecl=138 recfm=F;
  input @002 account_no $29. ;
run;

you will not get that message.  That message is only generated when a quoted string really is longer than 262 characters.

 

Usually in this case where you can't see an unmatched quote, and can't see a long string, it means you had an earlier unmatched quote somewhere in your SAS code / SAS session.  

 

The easiest way to close an unmatched quote is to start a fresh SAS session.  Alternatively you can try submitting  a magic string like:

*';*";

which could close a prior unmatched quote.

 

But in order to figure out what caused this problem, you will need to look at the code earlier in your program to search for an unmatched quote.

The Boston Area SAS Users Group is hosting free webinars!
Next webinar will be in January 2025. Until then, check out our archives: https://www.basug.org/videos. And be sure to subscribe to our our email list.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 997 views
  • 4 likes
  • 5 in conversation