BookmarkSubscribeRSS Feed
alepage
Barite | Level 11

Hello, 

 

I am trying to run the code below and I receive the following error message: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation

marks.
 
Any suggestion?
Regards,
Alain

 

proc format;
value $vprec '1999' - '9999' = '@2016\@1231';
run;
%macro NATP;
%GLOBAL ANTP VPREC;
%LET VPREC=%SYSFUNC(PUTC(&ANTP,'$VPREC.'));
%MEND ANTP;
%LET AN1=2016;
%ANTP(&AN1);
%LET TOTO ="A108\RATING\COUTPRE2\T&AN1.\&VPREC.";
%put &toto;

6 REPLIES 6
Jagadishkatam
Amethyst | Level 16

 

could you please try to use the option noquotelenmax;

 

Thanks,
Jag
Astounding
PROC Star

I can see a few issues, although none of them would cause that message.  

 

The name of the macro is wrong (NATP instead of ANTP).

 

The macro definition doesn't contain any parameters, yet you call the macro with a parameter.

 

These two issues mean that you aren't showing the code that you actually used, so it's speculation as to what is causing the problem.

 

In addition, macro language doesn't use quotes to identify character strings.  So the quotes around '$VPREC.' should probably removed.  I can't test it right now, but I would be surprised if that worked.

 

Finally, your character format is suspect.  The range '1999' - '9999' almost certainly includes values that you don't want to include.  All of these values fall into that range:

 

500

7ABC

3.14159

 

It's possible you should be using a numeric format instead.

alepage
Barite | Level 11

Thanks for your help. It is very appreciated.

Here's the code that I have test and works properly

 

proc format;

value $vprec '1999' - '9999' = '@2016\@1231';

run;

%macro ANTP(ANTP=);

%GLOBAL VPREC;

%LET VPREC=%SYSFUNC(PUTC(&ANTP,$VPREC));

%MEND ANTP;

%LET AN1=2016;

%ANTP(ANTP=&AN1);

%LET TOTO ="A108\RATING\COUTPRE2\T&AN1.\&VPREC.";

%put &toto;

 

Regards,

Alain

alepage
Barite | Level 11

This code is a little bit simpler and is also working.

 

proc format;

value vprec 1999 - 9999 = @2016\@1231;

run;

%macro ANTP(ANTP=);

%GLOBAL VPREC;

%LET VPREC=%SYSFUNC(PUTC(&ANTP,VPREC.));

%MEND ANTP;

Astounding
PROC Star

When you say the code is working, does that mean the message about unbalanced quotes has vanished?

 

I would suggest that your numeric format (much preferred, per my earlier comments about the character format) needs quotes around the label:

 

proc format;

value vprec 1999 - 9999 = '@2016\@1231';

run;

alepage
Barite | Level 11
Small error in my original code. Here's the good one

proc format;

value vprec 1999 - 9999 = @2016\@1231;

run;

%macro ANTP(ANTP=);

%GLOBAL VPREC;

%LET VPREC=%SYSFUNC(PUTN(&ANTP,VPREC.));

%MEND ANTP;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1009 views
  • 0 likes
  • 3 in conversation