BookmarkSubscribeRSS Feed
harrylui
Obsidian | Level 7

HI ALL

 

DOES ANYONE KNOW HOW TO RUN IT SUCCESSFULLY

 

WHAT IS THE PROBLEM WITH THIS CODE

 

%MACRO SponsorMonthly1(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
;
run;


%mend;

%SponsorMonthly1(A=('GMMAE' 'GMMAM') , C=('A10'));

 

 

THIS IS MY LOG BUT I DON'T KNOW WHAT IS HAPPENING

 

 

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
22 %LET _SASPROGRAMFILE = %BQUOTE();
24 %LET _EXECENV=SASStudio;
 
______________________________________________________________________________________________________________________
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.
 
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/afa6fdb0-2f7c-4146-8a04-51778cf0d01f);
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: Program 1')
53 ! STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
53 ! CSS_PREFIX='.ods_afa6fdb0-2f7c-4146-8a04-51778cf0d01f' BODY_ID='div_afa6fdb0-2f7c-4146-8a04-51778cf0d01f' );
54 ODS RTF (ID=WEB) STYLE=Rtf FILE=_RTFOUT sasdate;
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
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.);
NOTE: ODS statements in the SAS Studio environment may disable some output features.
61 OPTIONS NOTES STIMER SOURCE NOSYNTAXCHECK;
62
63 %MACRO SponsorMonthly1(A=,C=);
ERROR: The macro SPONSORMONTHLY1 is still executing and cannot be redefined.
ERROR: A dummy macro will be compiled.
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 ;
79 run;
80
81
82 %mend;
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
83
84 %SponsorMonthly1(A=('GMMAE' 'GMMAM') , C=('A10'));
85
86
87 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
88 ODS HTML CLOSE;
89 &GRAPHTERM; ;*';*";*/;RUN;QUIT;
90 QUIT;RUN;
91 ODS HTML5 (ID=WEB) CLOSE;
92
93 ODS RTF (ID=WEB) CLOSE;
94 ODS PDF (ID=WEB) CLOSE;
95 FILENAME _GSFNAME;
96 DATA _NULL_;
97 RUN;
98 OPTIONS VALIDMEMNAME=COMPAT;
99 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
100
 
3 REPLIES 3
Reeza
Super User

1. Restart SAS

2. Does your query work if hardcoded, ie not a macro? If not, fix that first. 

3. Proc sql needs a QUIT not a RUN to end. 

4. DONT TYPE IN CAPSLOCK. ITS HARD TO READ AND IS THE EQUIVALENT OF YELLING AT PEOPLE. When used APPROPRIATELY it helps highlight key words, but it’s not recommended for coding either. 


@harrylui wrote:

HI ALL

 

DOES ANYONE KNOW HOW TO RUN IT SUCCESSFULLY

 

WHAT IS THE PROBLEM WITH THIS CODE

 

%MACRO SponsorMonthly1(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
;
run;


%mend;

%SponsorMonthly1(A=('GMMAE' 'GMMAM') , C=('A10'));

 

 

THIS IS MY LOG BUT I DON'T KNOW WHAT IS HAPPENING

 

 

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
22 %LET _SASPROGRAMFILE = %BQUOTE();
24 %LET _EXECENV=SASStudio;
 
______________________________________________________________________________________________________________________
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.
 
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/afa6fdb0-2f7c-4146-8a04-51778cf0d01f);
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: Program 1')
53 ! STYLE=Htmlblue OPTIONS(BITMAP_MODE='INLINE' OUTLINE='ON' SVG_MODE='INLINE'
53 ! CSS_PREFIX='.ods_afa6fdb0-2f7c-4146-8a04-51778cf0d01f' BODY_ID='div_afa6fdb0-2f7c-4146-8a04-51778cf0d01f' );
54 ODS RTF (ID=WEB) STYLE=Rtf FILE=_RTFOUT sasdate;
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
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.);
NOTE: ODS statements in the SAS Studio environment may disable some output features.
61 OPTIONS NOTES STIMER SOURCE NOSYNTAXCHECK;
62
63 %MACRO SponsorMonthly1(A=,C=);
ERROR: The macro SPONSORMONTHLY1 is still executing and cannot be redefined.
ERROR: A dummy macro will be compiled.
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 ;
79 run;
80
81
82 %mend;
NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.
83
84 %SponsorMonthly1(A=('GMMAE' 'GMMAM') , C=('A10'));
85
86
87 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
88 ODS HTML CLOSE;
89 &GRAPHTERM; ;*';*";*/;RUN;QUIT;
90 QUIT;RUN;
91 ODS HTML5 (ID=WEB) CLOSE;
92
93 ODS RTF (ID=WEB) CLOSE;
94 ODS PDF (ID=WEB) CLOSE;
95 FILENAME _GSFNAME;
96 DATA _NULL_;
97 RUN;
98 OPTIONS VALIDMEMNAME=COMPAT;
99 OPTIONS NOTES STIMER SOURCE SYNTAXCHECK;
100
 

 

ballardw
Super User

This from the top your log:

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.

Indicates that some where before the code shown was run you have something quoting strings and quite possibly the quotes are not closed properly. Possibly use of a 'string" or "string" or just plain unclosed 'string   .

 

So you need to look to code submitted previously. Note that a single one of these mismatched quotes will cause almost every other statement involving quotes to generate one or more errors or messages depending on where the later quotes are used.

Also:

AND Written.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE MeridianSponsor.Sponsor in &C
;

There is no matching ) to go with the highlighted ( .

 

 

Debugging macros is easier if you

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
  • 1697 views
  • 0 likes
  • 4 in conversation