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. 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 quotationmarks.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);2122 %LET _SASPROGRAMFILE = %BQUOTE();23 %LET _BASEURL = %BQUOTE(http://cbrtplpst01.chubb.com:7980/SASStudio/);24 %LET _EXECENV=SASStudio;______________________________________________________________________________________________________________________49NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white spacebetween a quoted string and the succeeding identifier is recommended.25 DATA _NULL_;26 CALL26 ! SYMPUT("GRAPHINIT"_4926 ! ,"");27 CALL27 ! SYMPUT("GRAPHTERM"_4927 ! ,"");NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white spacebetween 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 4932 CALL SYMPUT("GRAPHTERM","GOPTIONS NOACCESSIBLE;");___ ___________________________________49 49NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white spacebetween a quoted string and the succeeding identifier is recommended.33 END;34 RUN;35 DATA _NULL_;36 RC=SYSPROD("PRODNUM002"_4936 ! );NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white spacebetween a quoted string and the succeeding identifier is recommended.37 IF (RC^=1) THEN DO;38 CALL38 ! SYMPUT("GRAPHINIT"_4938 ! ,"");NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white spacebetween 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 quotationmarks.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;6263 %MACRO SponsorMonthly1(A=,C=);ERROR: The macro SPONSORMONTHLY1 is still executing and cannot be redefined.ERROR: A dummy macro will be compiled.6465 proc sql;66 create table67 PortfolioPeriods as68 SELECT69 BusinessUnit70 ,Written.Period71 ,Written.UWYear72 ,Written.ExposurePeriod73 FROM Written74 WHERE Written.Period >= 20120175 AND Written.Pac IN &A76 AND Written.PolicyNo IN (SELECT MeridianSponsor.MeridianNo as Policy_No FROM MeridianSponsor WHERE76 ! MeridianSponsor.Sponsor in &C7778 ;79 run;808182 %mend;NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotationmarks.8384 %SponsorMonthly1(A=('GMMAE' 'GMMAM') , C=('A10'));858687 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;88 ODS HTML CLOSE;89 &GRAPHTERM; ;*';*";*/;RUN;QUIT;90 QUIT;RUN;91 ODS HTML5 (ID=WEB) CLOSE;9293 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
You have unbalanced quotes further up in the code you submitted. Find those and fix them.
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.