Desktop productivity for business analysts and programmers

Trying to execute two macro function while passing the ith value of a macro variable

Reply
Regular Contributor
Posts: 168

Trying to execute two macro function while passing the ith value of a macro variable

Hello SAS Experts,

 

I am receiving this error message (The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation marks.)  while run the code bellow.

 

How do we correct this problem?

 

Here's my code:

 

 

%let liste1=4514 4530 4532 4548 4557 4595 4598 4621 4631 4673;
%macro loop(vlist);
%let nobs1=%sysfunc(countw(&vlist));/*Number of sale agents*/
%do i=1 %to &nobs1;
%let Temp=%sysfunc(compress(%scan(&vlist,&i)));
%calcul(&Temp);
%rapport(&Temp);
%end;
%loop(&liste1.);

 

log file:

 

1 Le Système SAS 13:04 Monday, January 15, 2018

1 ;*'
_
49
1 ! ;*";*/;quit;run;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.

2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='VT_Outil Ma Contribution par agent 2018_ALP3'
_______________________________
49
3 ! ;
4 %LET _CLIENTPROCESSFLOWNAME='Flux de processus'
_
49
4 ! ;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.

5 %LET _CLIENTPROJECTPATH='';
6 %LET _CLIENTPROJECTPATHHOST='';
7 %LET _CLIENTPROJECTNAME='';
8 %LET _SASPROGRAMFILE='S:\IAAH\IaahCycleSAS_DEV\Rapports\TRTRPDNC\Operationnel\VT_Outil Ma Contribution par agent
8 ! 2018_ALP3.sas'
_
49
8 ! ;
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space
between a quoted string and the succeeding identifier is recommended.

9 %LET _SASPROGRAMFILEHOST='LT1300';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=PNG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 FILENAME EGSR TEMP;
15 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR
16 STYLE=HTMLBlue
17 STYLESHEET=(URL="file:///C:/Program%20Files/SAS94/SASHome/SASEnterpriseGuide/7.1/Styles/HTMLBlue.css")
18 NOGTITLE
19 NOGFOOTNOTE
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
20 GPATH=&sasworklocation
21 ENCODING=UTF8
22 options(rolap="on")
23 ;
24
25 GOPTIONS ACCESSIBLE;
26 %let liste1=4514 4530 4532 4548 4557 4595 4598 4621 4631 4673;
27 %macro loop(vlist);
28 %let nobs1=%sysfunc(countw(&vlist));/*Number of sale agents*/
29 %do i=1 %to &nobs1;
30 %let Temp=%sysfunc(compress(%scan(&vlist,&i)));
31 %calcul(&Temp);
32 %rapport(&Temp);
33 %end;
34 %loop(&liste1.);
2 Le Système SAS 13:04 Monday, January 15, 2018

35
36 GOPTIONS NOACCESSIBLE;
37 %LET _CLIENTTASKLABEL=;
38 %LET _CLIENTPROCESSFLOWNAME=;
39 %LET _CLIENTPROJECTPATH=;
40 %LET _CLIENTPROJECTPATHHOST=;
41 %LET _CLIENTPROJECTNAME=;
42 %LET _SASPROGRAMFILE=;
43 %LET _SASPROGRAMFILEHOST=;
44
45 ;*';*";*/;quit;run;
46 ODS _ALL_ CLOSE;
47
48
49 QUIT; RUN;
50

 

 

Super User
Posts: 24,010

Re: Trying to execute two macro function while passing the ith value of a macro variable

Those errors are actually coming before your code. 

 

What happens if you restart, for a clean session, and submit the following code. Does that generate the same errors?

 

proc means data=sashelp.class;
run;
Regular Contributor
Posts: 168

Re: Trying to execute two macro function while passing the ith value of a macro variable

I have tried this solution but still the same error?

PROC Star
Posts: 1,471

Re: Trying to execute two macro function while passing the ith value of a macro variable

[ Edited ]

The code you have showed does not cause the error.  The below runs fine:

 

%let liste1=4514 4530 4532 4548 4557 4595 4598 4621 4631 4673;
%macro loop(vlist);
%let nobs1=%sysfunc(countw(&vlist));/*Number of sale agents*/
%do i=1 %to &nobs1;
  %let Temp=%sysfunc(compress(%scan(&vlist,&i)));
  /** 
  %calcul(&Temp);
  %rapport(&Temp);
  **/
  %put Temp=&Temp ;
%end;
%mend loop ;
%loop(&liste1.);

 

This suggests the problem is either earlier in your code / SAS session, or in one of the macros you are invoking, %calcul or %rapport.

 

Note it looks like your code is missing a %MEND statement to end the definition of %loop.

Regular Contributor
Posts: 168

Re: Trying to execute two macro function while passing the ith value of a macro variable

Thanks a lot for your help.

 

Please note that my %MEND statement to end the definition of %loop in not missing (see the 3 last lines)

%end;
%mend loop ;
%loop(&liste1.);

moreover, I agree with you that I have error(s) generated by the execution of my macro function either
%rapport or %calcul;

Regards,
Alain

 

 

PROC Star
Posts: 1,471

Re: Trying to execute two macro function while passing the ith value of a macro variable

[ Edited ]

Did you copy the last three lines from my post? I added a %MEND to test out your code.

 

Looking at the code and log from your initial post, I don't see a %MEND statement before you call %loop:

 

26 %let liste1=4514 4530 4532 4548 4557 4595 4598 4621 4631 4673;
27 %macro loop(vlist);
28 %let nobs1=%sysfunc(countw(&vlist));/*Number of sale agents*/
29 %do i=1 %to &nobs1;
30 %let Temp=%sysfunc(compress(%scan(&vlist,&i)));
31 %calcul(&Temp);
32 %rapport(&Temp);
33 %end;
34 %loop(&liste1.);

 

Missing a %MEND statement can cause all sorts of interesting problems.

Regular Contributor
Posts: 168

Re: Trying to execute two macro function while passing the ith value of a macro variable

I agree with you.

Alain

Ask a Question
Discussion stats
  • 6 replies
  • 189 views
  • 0 likes
  • 3 in conversation