BookmarkSubscribeRSS Feed
Jesusismygrace
Obsidian | Level 7

For the life of me, I can not figure out my I am getting the below error message
%macro population_setup;
%global pop_logic;
%if "&population." = "MedicareHMOH0504" %then %do;
%let pop_logic = payercode = 'RR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('M');
%end;
%else %if "&population." = "MedicareHMOH5928" %then %do;
%let pop_logic = (payercode in ('RR', 'NR') and ProductCode = 'H' and MemberEnrollmentAltID8 in ('R')) or
(payercode in ('RR', 'NR') and ProductCode = 'H' and MemberEnrollmentAltID8 in ('D', 'E') and memberenrollmentaltid12 = '');
%end;
%else %if "&population." = "MedicarePPO" %then %do;
%let pop_logic = payercode = 'RR' and ProductCode = 'P' and MemberEnrollmentAltID8 = 'Z';
%end;
%else %if "&population." = "MedicareSNP005" %then %do;
%let pop_logic = (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('H', 'I', 'J')) or
(payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('D', 'E') and MemberEnrollmentAltID12 = 'SNP005_YES');
%end;
%else %if "&population." = "MedicareSNP054" %then %do;
%let pop_logic = (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 = 'W') or
(payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('D', 'E') and MemberEnrollmentAltID12 = 'SNP054_YES');
%end;
%mend;
%population_setup;
%let datek = '01JAN2024'D;

 

/** Pull PHP Medicare members as of 01JAN2024 **/
proc sql;
create table php_mcare_mem (compress=yes) as
select distinct memberkey, TerminationDate, PayerCode, ProductCode, MemberEnrollmentAltID8
from php.ENROLL_PROMISE_FINAL_COLLAPSED as a
where &population_setup. and TerminationDate GT &datek.
order by memberkey, TerminationDate;
quit;

 

 

Error Message

The SAS System 09:32 Tuesday, July 16, 2024

1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='MY24_Medicare_CAHPS_Combined.sas';
4 %LET _CLIENTPROCESSFLOWNAME='Process Flow';
5 %LET
5 ! _CLIENTPROJECTPATH='/home/ijones01/sasdata3_MI_projects_hedis_vendor/production/inovalon/programs/hedisMY2024/hos/
5 ! MY24_HOS.egp';
6 %LET _CLIENTPROJECTPATHHOST='uapp6227p.bsc.bscal.com';
7 %LET _CLIENTPROJECTNAME='MY24_HOS.egp';
8 %LET
8 ! _SASPROGRAMFILE='/home/ijones01/sasdata3_MI_projects_hedis_vendor/production/inovalon/programs/hedisMY2024/hos/MY2
8 ! 4_Medicare_CAHPS_Combined.sas';
9 %LET _SASPROGRAMFILEHOST='uapp6227p.bsc.bscal.com';
10
11 ODS _ALL_ CLOSE;
12 OPTIONS DEV=SVG;
13 GOPTIONS XPIXELS=0 YPIXELS=0;
14 %macro HTML5AccessibleGraphSupported;
15 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) >= 0 %then ACCESSIBLE_GRAPH;
16 %mend;
17 FILENAME EGHTML TEMP;
18 ODS HTML5(ID=EGHTML) FILE=EGHTML
19 OPTIONS(BITMAP_MODE='INLINE')
20 %HTML5AccessibleGraphSupported
21 ENCODING='utf-8'
22 STYLE=HtmlBlue
23 NOGTITLE
24 NOGFOOTNOTE
25 GPATH=&sasworklocation
26 ;
NOTE: Writing HTML5(EGHTML) Body file: EGHTML
27
28 libname MCAHPS '/sasdata3_MI_projects_hedis_vendor/production/inovalon/programs/hedisMY2024/hos';
NOTE: Libref MCAHPS was successfully assigned as follows:
Engine: V9
Physical Name: /sasdata3_MI_projects_hedis_vendor/production/inovalon/programs/hedisMY2024/hos
29 libname php '/sasdata3_MI_projects_hedis_vendor/production/inovprev/data/extract/membership/php';
NOTE: Libref PHP was successfully assigned as follows:
Engine: V9
Physical Name: /sasdata3_MI_projects_hedis_vendor/production/inovprev/data/extract/membership/php
30 libname bsc '/sasdata3_MI_projects_hedis_vendor/production/inovprev/data/extract/membership/';
NOTE: Libref BSC was successfully assigned as follows:
Engine: V9
Physical Name: /sasdata3_MI_projects_hedis_vendor/production/inovprev/data/extract/membership
31 libname bsc_prvd '/sasdata3_MI_projects_hedis_vendor/production/inovprev/data/final';
NOTE: Libref BSC_PRVD was successfully assigned as follows:
Engine: V9
Physical Name: /sasdata3_MI_projects_hedis_vendor/production/inovprev/data/final
32 %macro population_setup;
33 %global pop_logic;
34 %if "&population." = "MedicareHMOH0504" %then %do;
35 %let pop_logic = payercode = 'RR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('M');
36 %end;
37 %else %if "&population." = "MedicareHMOH5928" %then %do;
38 %let pop_logic = (payercode in ('RR', 'NR') and ProductCode = 'H' and MemberEnrollmentAltID8 in
2 The SAS System 09:32 Tuesday, July 16, 2024

38 ! ('R')) or
39 (payercode in ('RR', 'NR') and ProductCode = 'H' and MemberEnrollmentAltID8 in
39 ! ('D', 'E') and memberenrollmentaltid12 = '');
40 %end;
41 %else %if "&population." = "MedicarePPO" %then %do;
42 %let pop_logic = payercode = 'RR' and ProductCode = 'P' and MemberEnrollmentAltID8 = 'Z';
43 %end;
44 %else %if "&population." = "MedicareSNP005" %then %do;
45 %let pop_logic = (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('H', 'I',
45 ! 'J')) or
46 (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('D', 'E')
46 ! and MemberEnrollmentAltID12 = 'SNP005_YES');
47 %end;
48 %else %if "&population." = "MedicareSNP054" %then %do;
49 %let pop_logic = (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 = 'W') or
50 (payercode = 'NR' and ProductCode = 'H' and MemberEnrollmentAltID8 in ('D', 'E')
50 ! and MemberEnrollmentAltID12 = 'SNP054_YES');
51 %end;
52 %mend;
53 %population_setup;
54 %let datek = '01JAN2024'D;
55
56
57
58 /** Pull PHP Medicare members as of 01JAN2024 **/


59 proc sql;
60 create table php_mcare_mem (compress=yes) as
61 select distinct memberkey, TerminationDate, PayerCode, ProductCode, MemberEnrollmentAltID8
62 from php.ENROLL_PROMISE_FINAL_COLLAPSED as a
63 where &population_setup. and TerminationDate GT &datek.
_
22
WARNING: Apparent symbolic reference POPULATION_SETUP not resolved.
63 where &population_setup. and TerminationDate GT &datek.
_______________
22
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant,
a datetime constant, a missing value, BTRIM, INPUT, PUT, SUBSTRING, USER.

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, -, /, <, <=, <>, =, >, >=, AND, EQ, EQT, GE,
GET, GROUP, GT, GTT, HAVING, LE, LET, LT, LTT, NE, NET, OR, ORDER, ^=, |, ||, ~=.

63 where &population_setup. and TerminationDate GT &datek.
_______________
76
ERROR 76-322: Syntax error, statement will be ignored.

64 order by memberkey, TerminationDate;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
65 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
3 The SAS System 09:32 Tuesday, July 16, 2024

cpu time 0.00 seconds

66
67 %LET _CLIENTTASKLABEL=;
68 %LET _CLIENTPROCESSFLOWNAME=;
69 %LET _CLIENTPROJECTPATH=;
70 %LET _CLIENTPROJECTPATHHOST=;
71 %LET _CLIENTPROJECTNAME=;
72 %LET _SASPROGRAMFILE=;
73 %LET _SASPROGRAMFILEHOST=;
74
75 ;*';*";*/;quit;run;
76 ODS _ALL_ CLOSE;
77
78
79 QUIT; RUN;
80

2 REPLIES 2
Tom
Super User Tom
Super User

It is a little hard to read your post since you pasted the log into the normal editor window as if it was paragraphs of text you were typing.  Next time use the Insert Code button to get a pop-up window to paste/edit your text and then it will be displayed as-is using monospace font.

 

It looks like you defined a macro named POPULATION_SETUP and then were able to call it using %POPULATION_SETUP .

 

But then later on you tried to reference a macro variable with the same name by using &POPULATION_SETUP.  But I do not see any place where you ever tried to define such a macro variable.

ballardw
Super User

In this code you reference a macro variable &population_setup.  Where do you think a value of that macro variable is assigned?

proc sql;
create table php_mcare_mem (compress=yes) as
select distinct memberkey, TerminationDate, PayerCode, ProductCode, MemberEnrollmentAltID8
from php.ENROLL_PROMISE_FINAL_COLLAPSED as a
where &population_setup. and TerminationDate GT &datek.
order by memberkey, TerminationDate;
quit;

Also your macro %population_setup repeatedly uses  a macro variable &Population that I do not see an assignment for anywhere such as a %let, Call symput or Symputx or SQL into: .

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 127 views
  • 0 likes
  • 3 in conversation