BookmarkSubscribeRSS Feed
harrylui
Obsidian | Level 7

HI ALL

 

does anyone know about my error?

 

this is my coding and i can't run the result 

 

%MACRO SponsorMonthly(A=,C=);

 

proc sql;
create table
PortfolioPeriods as
SELECT
BusinessUnit
,Written.Period
,Written.UWYear
,Written.ExposurePeriod
FROM Written
WHERE Written.Period >= 201201
AND Written.Pac IN &A
AND Written.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor in &C)

UNION

SELECT
BusinessUnit
,Earned.Period
,Earned.UWYear
,Earned.ExposurePeriod
FROM Earned
WHERE Earned.Period >= 201201
AND Earned.Pac IN &A
AND Earned.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor in &C)
UNION

SELECT
BusinessUnit
,Claim.Period
,Claim.UWYear
,Claim.EventPeriod
FROM Claim
WHERE Claim.Period >= 201201
AND Claim.Pac IN &A
AND Claim.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor in &C)
;
run;

%mend;

%SponsorMonthly(A=('GMMAE' 'GMMAM' 'GMMAN' 'GMMAX' 'GMMCB' 'GMMCM' 'GMMOP' 'GMMOS' 'GAODM' 'GAOCR' 'GMMAF' 'GDDDM' 'GDOCR'),C=('A10');

 

 

 

 

 

 

 

 

 

this is my error script:

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
2 TITLE;
3 FOOTNOTE;
4 OPTIONS LOCALE=en_US DFLANG=LOCALE;
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
5 DATA _NULL_;
6 RUN;
7 OPTIONS VALIDVARNAME=ANY;
8 OPTIONS VALIDMEMNAME=COMPAT;
9 FILENAME _HTMLOUT TEMP;
10 FILENAME _RTFOUT TEMP ENCODING='UTF-8';
11 FILENAME _PDFOUT TEMP;
12 FILENAME _GSFNAME TEMP;
13 FILENAME _DATAOUT TEMP;
14 %LET SYSCC=0;
15 %LET _CLIENTAPP=SAS Studio;
16 %LET _CLIENTAPPVERSION=3.6;
17 %LET _SASSERVERNAME=%BQUOTE(SASAPAC);
18 %LET _CLIENTUSERID=%BQUOTE(f022m54);
19 %LET _CLIENTUSERNAME=%BQUOTE(Harry Lui (Kwan Hin));
20 %LET CLIENTMACHINE=%BQUOTE(10.134.5.173);
21
111 &GRAPHTERM; ;*';*";*/;RUN;QUIT;
______________
49
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.
 
22 %LET _SASPROGRAMFILE =
22 ! %BQUOTE(/opt/data/SAS_S/sas94/sasdata/exploration/APAC/HongKong/Harry.Lui/DMmonthlyreportsecondhalf.sas);
24 %LET _EXECENV=SASStudio;
25 DATA _NULL_;
26 CALL
26 ! SYMPUT("GRAPHINIT"
_
49
26 ! ,"");
27 CALL
27 ! SYMPUT("GRAPHTERM"
_
49
27 ! ,"");
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.
 
28 RC=TSLVL('GEOCODE','N');
29 _ERROR_=0;
30 IF (RC^=' ') THEN DO;
31 CALL SYMPUT("GRAPHINIT","GOPTIONS RESET=ALL GSFNAME=_GSFNAME;");
___ ________________
49 49
32 CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");
___ ___________________________________
49 49
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.
 
33 END;
34 RUN;
35 DATA _NULL_;
36 RC=SYSPROD("PRODNUM002"
_
49
36 ! );
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.
 
37 IF (RC^=1) THEN DO;
38 CALL
38 ! SYMPUT("GRAPHINIT"
_
49
38 ! ,"");
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.
 
39 CALL SYMPUT("GRAPHTERM","");
40 END;
41 RUN;
42 %LET _DATAOUT_MIME_TYPE=;
43 %LET _DATAOUT_NAME=;
44 %LET _DATAOUT_TABLE=;
45 %LET _DATAOUT_URL=;
46 %SYMDEL _DATAOUT_MIME_TYPE _DATAOUT_NAME _DATAOUT_URL _DATAOUT_TABLE;
47 %LET _SASWS_ = %BQUOTE(/u/f022m54);
48 %LET _SASWSTEMP_=%BQUOTE(/u/f022m54/.images/579a36c4-f6af-4565-9213-bb1c4d8446e8);
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
49 ODS LISTING CLOSE;
50 OPTIONS PRINTERPATH=PDF;
51 ODS AUTONAVIGATE OFF;
52 ODS GRAPHICS ON;
53 ODS HTML5 (ID=WEB) DEVICE=PNG GPATH="&_SASWSTEMP_" ENCODING=utf8 FILE=_HTMLOUT (TITLE='Results:
53 ! DMmonthlyreportsecondhalf.sas') STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
53 ! CSS_PREFIX='.ods_579a36c4-f6af-4565-9213-bb1c4d8446e8' BODY_ID='div_579a36c4-f6af-4565-9213-bb1c4d8446e8' );
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
54 ODS RTF (ID=WEB) STYLE=Rtf FILE=_RTFOUT sasdate;
55 ODS PDF (ID=WEB) STYLE=Pearl FILE=_PDFOUT;
56 &GRAPHINIT;
57 OPTIONS FIRSTOBS=1;
58 OPTIONS OBS=MAX;
59 OPTIONS DTRESET DATE NUMBER NOTES;
60 %put %bquote(NOTE: ODS statements in the SAS Studio environment may disable some output features.);
61 OPTIONS NOTES STIMER SOURCE NOSYNTAXCHECK;
62
63 %MACRO SponsorMonthly(A=,C=);
64
65 proc sql;
66 create table
67 PortfolioPeriods as
68 SELECT
69 BusinessUnit
70 ,Written.Period
71 ,Written.UWYear
72 ,Written.ExposurePeriod
73 FROM Written
74 WHERE Written.Period >= 201201
75 AND Written.Pac IN &A
76 AND Written.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE
76 ! MeridianSponsor.Sponsor in &C)
77
78 UNION
79
80 SELECT
81 BusinessUnit
82 ,Earned.Period
83 ,Earned.UWYear
84 ,Earned.ExposurePeriod
85 FROM Earned
86 WHERE Earned.Period >= 201201
87 AND Earned.Pac IN &A
88 AND Earned.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE
88 ! MeridianSponsor.Sponsor in &C)
89 UNION
90
91 SELECT
92 BusinessUnit
93 ,Claim.Period
94 ,Claim.UWYear
95 ,Claim.EventPeriod
96 FROM Claim
97 WHERE Claim.Period >= 201201
98 AND Claim.Pac IN &A
99 AND Claim.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor
99 ! in &C)
100 ;
101 run;
102
103 %mend;
104
105 %SponsorMonthly(A=('GMMAE' 'GMMAM' 'GMMAN' 'GMMAX' 'GMMCB' 'GMMCM' 'GMMOP' 'GMMOS' 'GAODM' 'GAOCR' 'GMMAF' 'GDDDM'
105 ! 'GDOCR'),C=('A10');
106
107
108 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
109 ODS HTML CLOSE;
110 &GRAPHTERM; ;*';*";*/;RUN;QUIT;
111 QUIT;RUN;
112 ODS HTML5 (ID=WEB) CLOSE;
113
114 ODS RTF (ID=WEB) CLOSE;
115 ODS PDF (ID=WEB) CLOSE;
116 FILENAME _GSFNAME;
117 DATA _NULL_;
118 RUN;
119 OPTIONS VALIDMEMNAME=COMPAT;
120 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
121
 
 
thanks for all helping!!
3 REPLIES 3
Kurt_Bremser
Super User

This

NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.

right at the top of the log means that your SAS session is already confused by unbalanced quotes. Terminate it and start a new one.

Second, don't use parantheses in macro parameters, as the first closing bracket will end the macro call.

Change your macro call:

%SponsorMonthly(a='GMMAE' 'GMMAM' 'GMMAN' 'GMMAX' 'GMMCB' 'GMMCM' 'GMMOP' 'GMMOS' 'GAODM' 'GAOCR' 'GMMAF' 'GDDDM' 'GDOCR',c='a10');

and change the way you use the parameters:

AND Written.Pac IN (&A)
AND Written.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor in (&C))
Tom
Super User Tom
Super User

Second, don't use parantheses in macro parameters, as the first closing bracket will end the macro call.

That statement is false.  Balanced use of () does not cause any issue with macro calls.

This is valid macro call.

%mymacro(data=want(label='My Table'))

In fact adding () is an easy way to allow your values to contain commas.

%mymacro(mylist=(1,2,3,4))
Kurt_Bremser
Super User

You're right. I did not test it with the brackets. So it must have been some other code that left the unbalanced quotes, and not the way the macro was called.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1082 views
  • 0 likes
  • 3 in conversation