Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SAS format file creation with long string.

Status
Not open for further replies.

wuliddd

Programmer
May 21, 2009
5
US
Hi:
I'm encouter an issue regarding to the long string in the user-defined format in SAS program. I believe the string is over 262 characters issue.

Here is my code and the file name is formtabc.sas

***********************************************************
LIBNAME HERE "c:\xxx\yyyy";
OPTIONS nodate ps=60 ls=80;

PROC FORMAT LIBRARY=HERE.formats;

VALUE ABC
1="Psychosis: Altered ability to function in normal activity due to severe disturbance in the perception of reality. Include hallucinations, incoherence, marked loose associations, impoverished thought content, marked illogical thinking, bizarre, disorganized, or catatonic behavior. Exclude uremia and drug causes.";

Run;

**********************************************************

The issue is that:

If I open this file in SAS interactive mode and click "submit" button and it successful create the formats.sas7bcat file for me.

If I "batch submit" by right click the file name and click "batch submit with SAS 9.1" then I have the following error:
**************************************************
ERROR 22-322: Syntax error, expecting one of the following: a quoted string,

ERROR 22-322: Syntax error, expecting one of the following: a quoted string,

ERROR 22-322: Syntax error, expecting one of the following: a quoted string,
a numeric constant, a datetime constant, a missing value, ;, LOW,

a numeric constant, a datetime constant, a missing value, ;, LOW,

a numeric constant, a datetime constant, a missing value, ;, LOW,
OTHER.
OTHER.
OTHER.
**********************************************************

I search the internet and find the solution is to put

option noquotelenmax;

in my code. but apprentaly is still not working in the batch mode.

Does anyone know how to release the long string limit in the code? and make it run in batch mode?

thank you in advnce.............

 
Formats I believe have a limit of $40 (thats 40 chars long). This was a limitation in SAS 8.2, I haven't checked in SAS 9.2 if they increased this limit.

Why not use a macro var?

Perhaps you can tell us what you need to do and we can come up with a solution. Let us know what kind of report you want to create and why you need such a long format var.

Klaz
 
Thank you for the quick reply.

The thing is I do not understand why if i open this file in the SAS Interactive mode and click "sumbit" and it sucessful create formats.sas7bcat.

But if I right click the file name and click "batch submit with SAS 9.1" then this format will have error and can not be created.

Can you please let me know what is the difference between interactive mode and batch mode? and why interactive mode does not care how long the string are and just let me create the format.
 
I take it back it seems that there is no longer a limit on formats. SAS interactive mode allows the format to be used. Perhaps the unbalanced quotes warning has something to do with it not running in batch mode.

Generally, you don't use a format to substitute text the way you describe. Perhaps you can explain what you're trying to do and we can suggest an alternative.

Klaz
 
thanks again.

What I try to do is simply create the user_defined format and store 1 and it will display the long string.

if there is no limit for the format string then do we know how to disable the checking for "unbalanced quotes" warning.

because as you can see my string is fine and no quotes need.

Here is the string again:
1 = "Psychosis: Altered ability to function in normal activity due to severe disturbance in the perception of reality. Include hallucinations, incoherence, marked loose associations, impoverished thought content, marked illogical thinking, bizarre, disorganized, or catatonic behavior. Exclude uremia and drug causes.
 
I was able to reproduce your error. You ask a good question. Why when you submit your code using the SAS GUI you encounter a WARNING, but the code compiles and runs. When you submit in batch mode the long text string throws an error.

I'll call SAS tech support in the morning about this one. My guess is that there are two ways to get to the compiler in sas. One, via the GUI, and two via the batch submit. They probably updated the GUI but never updated the batch submit entry point.

Klaz
 
thank you so much and looking forward for your response.
 
Thank you for this information:

But this article does not indicate that the issue will still exist in "batch mode".

Can you please specify a little bit more?
 
I called Tech support @ SAS and they pointed me to a SAS NOTE.
See below


It has to do with the LRECL option. In SAS 9.2 they should include this as a system option. (The idea being if you need to change the length of your read-in-line-length (you have a long text string) then you should be able to.)

I hope you can use this.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top