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:
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))
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))
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 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.