Monday, April 26, 2010

WARNING: You may have unbalanced quotation marks.

SAS can allow the strings up to 32,767 characters long but some times SAS will write a Warning message WARNING: The quoted string currently being processed has become more than 262 characters long. You may have unbalanced quotation marks., when you try to keep a character string longer than 262 characters to a variable.  It is hard to look back at the SAS code to search for unbalanced quotes.
To make it more clearly I am going to show an example.

I want to add a 263 characters long name to a variable (longvar) and to do that I will simply use a data step… and when I do that I will see the WARNING message in Log.

data TEST;
x="(SEE DOCTOR'S LETTER)3RD ADMINISTRATION OF MTX WAS DELAYED BY 14 DAYS AND WAS REDUCED TO 1G/M2 INSTEAD OF 5G/M2, PROBLEMS, E.COLI SEPSIS WITH HEART INSUFFICIENCY WITH SINUS TACHYCARDY, PARALYTIC ILEUS, TACHYPNEA , PATIENT DIED ON 21.04.98 FROM MULTIORGAN FAILURE.";
y=length(x);
put x;
run;

LOG FILE:

There is a SAS option (NOQUOTELENMAX) which will take care of the WARNING message.

Options noQuoteLenMax; *Just before the Data step;

Don’t forget to change back to Options QuoteLenMax; after the end of the Data step.

Options noQuoteLenMax;

0 comments:

Post a Comment

ShareThis