Hi,
Below are the logs for the next two steps. We thought the index ran without issues but the service would not run so it seems they both have issues. The full logs are below- but I cut and pasted the error parts directly below
The index has an error after line 28 ERROR: Libname BNDLRIN is not assigned. We just followed the instructions and ran the program, so we are unsure what would be wrong with it.
Services is probably wrong because of the Index file- but it notes an error with a
ERROR: Libname BNDLRIN is not assigned.
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
377:192 377:138
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
WARNING: Apparent symbolic reference NUM_ITER not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: &num_iter.
The SAS System 11:05 Thursday, May 17, 2012
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='2_index_events';
4 %LET _CLIENTPROJECTPATH='';
5 %LET _CLIENTPROJECTNAME='';
6 %LET _SASPROGRAMFILE='C:\CMMI BP Freeware Analytic Package Version
6 ! 1.2\primary_bundler\2_index_events.sas';
7
8 ODS _ALL_ CLOSE;
9 OPTIONS DEV=ACTIVEX;
10 GOPTIONS XPIXELS=0 YPIXELS=0;
11 FILENAME EGSR TEMP;
12 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR STYLE=HtmlBlue
12 ! STYLESHEET=(URL="file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/5.1/Styles/Htm
12 ! lBlue.css") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8
12 ! options(rolap="on");
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
13
14 GOPTIONS ACCESSIBLE;
15
16 *****************************;
17 * JOB: Primary Bundling
18 * STEP: Index Events
19 * PURPOSE: Identify all possible index events
20 * DATE: 2011-02-12
21 *****************************;
22
23
24
25 data index_events (drop=prpayamt pmtdnlcd index = (key = (bid_grp_2 file_type
25 ! admsn_dt from_dt))) ;
26 set bndlrin.services (keep=row_id file_type bid_grp_2 provider at_npi op_npi
27 admsn_dt dschrgdt from_dt thru_dt drg_cd stus_cd
27 ! src_adms prpayamt pmtdnlcd
28 where=(file_type in ('IP', 'SN', 'HH') and prpayamt=0 and
28 ! pmtdnlcd = '')
ERROR: Libname BNDLRIN is not assigned.
29 ) ;
ERROR: Libname BNDLRIN is not assigned.
30 ** Infer home health admission date.
31 TEMPORARY until SERVICES is fixed to populate ADMSN_DT for HH ** ;
WARNING: The variable prpayamt in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable pmtdnlcd in the DROP, KEEP, or RENAME list has never been referenced.
ERROR: Variable bid_grp_2 is not on file WORK.INDEX_EVENTS.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.INDEX_EVENTS may be incomplete. When this step was stopped there
were 0 observations and 0 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
32 data index_events ;
2 The SAS System 11:05 Thursday, May 17, 2012
33 set index_events ;
34 by bid_grp_2 file_type admsn_dt from_dt ;
35
36 retain admsn_dt_hh ;
37 prior_thru = lag(thru_dt) ;
38 if file_type = 'HH' then do ;
39 if first.file_type or (not first.bid_grp_2 and from_dt > prior_thru+1)
40 then admsn_dt_hh = from_dt ;
41 admsn_dt = admsn_dt_hh ;
42 end ;
43 drop prior_thru admsn_dt_hh ;
44 ** END TEMP ** ;
45 * Roll-up post-acute inst. claims to stay. *;
NOTE: Variable thru_dt is uninitialized.
NOTE: Variable file_type is uninitialized.
NOTE: Variable from_dt is uninitialized.
ERROR: BY variable bid_grp_2 is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable file_type is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable admsn_dt is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable from_dt is not on input data set WORK.INDEX_EVENTS.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.INDEX_EVENTS may be incomplete. When this step was stopped there
were 0 observations and 4 variables.
WARNING: Data set WORK.INDEX_EVENTS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
46 data index_events (index=(bundle_id));
47 set index_events ;
48 by bid_grp_2 file_type admsn_dt from_dt ;
49
50 format index_adm_dt index_dis_dt yymmdd10. ;
51 if file_type = 'IP' then do ; *NOTE: Drop this portion if CMMI version of input
51 ! dataset is by claim and admsn_dt is populated. * ;
52 index_adm_dt = from_dt ;
53 index_dis_dt = thru_dt ;
54 end ;
55 else do ;
56 retain index_adm_dt ;
57 index_adm_dt = admsn_dt ;
58 index_dis_dt = thru_dt ;
59 end ;
60 los = index_dis_dt - index_adm_dt ; ;
61 if file_type = 'IP' or last.admsn_dt;
62 rename
63 row_id = bundle_id
64 drg_cd = index_drg
65 provider = index_provider
66 at_npi = index_at_npi
3 The SAS System 11:05 Thursday, May 17, 2012
67 op_npi = index_op_npi ;
68 ;
69 drop admsn_dt dschrgdt from_dt thru_dt ;
70 run ;
NOTE: Variable file_type is uninitialized.
NOTE: Variable from_dt is uninitialized.
NOTE: Variable thru_dt is uninitialized.
NOTE: Variable admsn_dt is uninitialized.
ERROR: BY variable bid_grp_2 is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable file_type is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable admsn_dt is not on input data set WORK.INDEX_EVENTS.
ERROR: BY variable from_dt is not on input data set WORK.INDEX_EVENTS.
ERROR: Variable bundle_id is not on file WORK.INDEX_EVENTS.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.INDEX_EVENTS may be incomplete. When this step was stopped there
were 0 observations and 4 variables.
WARNING: Data set WORK.INDEX_EVENTS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
71
72 * For post-acute, identify recent acute stays and obtain that drg.
73 Flag index events as potential Model 2 or 4 (model_base = 2) or
74 potential Model 3 (model_base = 3). ;
75 proc sql;
76 create table index_events (where = (qual_drg is not missing ) index=(bundle_id) ) as
77 select
78 ie.*,
79 case when qual.index_drg is not missing then qual.index_drg
80 else ie.index_drg end as qual_drg,
81 case when qual.bid_grp_2 is not missing then 3 else 2 end as model_base ,
82 qual.index_dis_dt as qual_dis_dt
83 from
84 index_events ie
85 left join
86 index_events (where = ((file_type = 'IP' and
87 put(put(substr(index_provider,3,4), $prov_type_cd.),
87 ! $prov_type_cat.) in ('Short Term', 'CAH', 'Psych.')))) qual
88 on
89 ie.bid_grp_2 = qual.bid_grp_2 and
90 qual.index_dis_dt between ie.index_adm_dt - 30 and ie.index_adm_dt and
91 NOT (ie.file_type = 'IP' and
92 put(put(substr(ie.index_provider,3,4), $prov_type_cd.), $prov_type_cat.) in
92 ! ('Short Term', 'CAH', 'Psych.')) ;
ERROR: Table WORK.INDEX_EVENTS doesn't have any columns. PROC SQL requires each of its tables
to have at least 1 column.
ERROR: Variable file_type is not on file WORK.INDEX_EVENTS.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
93 quit ;
NOTE: The SAS System stopped processing this step because of errors.
4 The SAS System 11:05 Thursday, May 17, 2012
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
94
95 * Make bundle id unique for post-acute events that have more than one acute stay
96 in preceding 30 days. *;
97 data index_events (index=(key=(bid_grp_2 index_adm_dt)) drop=bundle_seq) ;
98 set index_events ;
99 by bundle_id ;
100 if not (first.bundle_id and last.bundle_id) then do ; *CONSIDER: Modify bundle_id
100 ! for ALL Model 3 cases*;
101 /*TEMP for testing*/if model_base = 2 then abort ;
102 if first.bundle_id then bundle_seq = 1 ;
103 else bundle_seq+1 ;
104 bundle_id = bundle_id * 10 + bundle_seq ;
105 end ;
106 else bundle_seq = . ;
107 run ;
NOTE: Variable model_base is uninitialized.
ERROR: BY variable bundle_id is not on input data set WORK.INDEX_EVENTS.
ERROR: Variable bid_grp_2 is not on file WORK.INDEX_EVENTS.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.INDEX_EVENTS may be incomplete. When this step was stopped there
were 0 observations and 2 variables.
WARNING: Data set WORK.INDEX_EVENTS was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
108
109 * Assign HCI3 condition and obtain principal diagnoses and procedures * ;
110 proc sql;
111 create table primbndl.index_events (index=(bundle_id index_provider index_drg
111 ! bid_grp_2 index_adm_dt )) as
112 select
113 ie.*,
114 case when put(qual_drg, $fmt_drg_cluster.) ne qual_drg then put(qual_drg,
114 ! $fmt_drg_cluster.)
115 else '' end as condition_hci3,
116 dx.code_value as index_prin_dx,
117 px.code_value as index_prin_px
118 from
119 index_events ie
120 left join
121 bndlrin.service_codes (keep=row_id code_type code_loc code_value
122 where = (code_type = 'Dx' and code_loc = 'P') ) dx
123 on
124 ie.bundle_id = dx.row_id
5 The SAS System 11:05 Thursday, May 17, 2012
125 left join
126 bndlrin.service_codes (keep=row_id code_type code_loc code_value
127 where = (code_type = 'Px' and code_loc = 'P') ) px
128 on
129 ie.bundle_id = px.row_id
130 order by
131 ie.bid_grp_2, ie.index_adm_dt, qual_dis_dt ;
ERROR: Table WORK.INDEX_EVENTS doesn't have any columns. PROC SQL requires each of its tables
to have at least 1 column.
ERROR: Libname BNDLRIN is not assigned.
ERROR: Libname BNDLRIN is not assigned.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
132 quit ;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
133
134 proc sql;
135 create table primbndl.ie_beneficiaries as
136 select distinct b.bid_grp_2, b.age, b.sex
137 from primbndl.index_events(keep=bid_grp_2) a, bndlrin.beneficiaries b
138 where a.bid_grp_2=b.bid_grp_2
139 order by 1;
ERROR: Libname PRIMBNDL is not assigned.
ERROR: Libname BNDLRIN is not assigned.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
140 quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
141
142
143 GOPTIONS NOACCESSIBLE;
144 %LET _CLIENTTASKLABEL=;
145 %LET _CLIENTPROJECTPATH=;
146 %LET _CLIENTPROJECTNAME=;
147 %LET _SASPROGRAMFILE=;
148
149 ;*';*";*/;quit;run;
150 ODS _ALL_ CLOSE;
151
152
153 QUIT; RUN;
154
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 The SAS System 11:05 Thursday, May 17, 2012
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET _CLIENTTASKLABEL='3_services_for_all_index_events';
4 %LET _CLIENTPROJECTPATH='';
5 %LET _CLIENTPROJECTNAME='';
6 %LET _SASPROGRAMFILE='C:\CMMI BP Freeware Analytic Package Version
6 ! 1.2\primary_bundler\3_services_for_all_index_events.sas';
7
8 ODS _ALL_ CLOSE;
9 OPTIONS DEV=ACTIVEX;
10 GOPTIONS XPIXELS=0 YPIXELS=0;
11 FILENAME EGSR TEMP;
12 ODS tagsets.sasreport13(ID=EGSR) FILE=EGSR STYLE=HtmlBlue
12 ! STYLESHEET=(URL="
file:///C:/Program%20Files/SASHome/SASEnterpriseGuide/5.1/Styles/Htm12 ! lBlue.css") NOGTITLE NOGFOOTNOTE GPATH=&sasworklocation ENCODING=UTF8
12 ! options(rolap="on");
NOTE: Writing TAGSETS.SASREPORT13(EGSR) Body file: EGSR
13
14 GOPTIONS ACCESSIBLE;
15
16 *****************************;
17 * JOB: Primary Bundling
18 * STEP: Services for all index events
19 * PURPOSE: Create a dataset with all services that might be needed for any bundle
20 that might be considered. Classify typical serivces and complications
21 with respecdt to the bundle type.
22 * DATE: 2011-02-12
23 *****************************;
24
25
26 *** Set number of beneficiaries to be processed in each iteration *** ;
27 %let chunk_size = 2500 ;
28 *** Desired location for log file *** ;
29 filename constlog 'e:\services' ; ;
30
31 %MACRO Get_all_services(num_bene) ;
32
33 data _null_ ;
34 set bndlrin.beneficiaries end = done ;
35 by bid_grp_2 ;
36 counter + 1 ;
37 if counter = &num_bene. or done then do ;
38 call symput('last_bene'||strip(put(num_iter+1, 5.)), bid_grp_2) ;
39 counter = 0 ;
40 num_iter + 1 ;
41 if done then call symput('num_iter', put(num_iter, 5.) );
42 end ;
43 if counter = 1 then call symput('first_bene'||strip(put(num_iter+1, 5.)),
43 ! bid_grp_2) ;
44 run ;
45
46 %DO iter = 1 %TO &num_iter. ;
47
2 The SAS System 11:05 Thursday, May 17, 2012
48 ** INCL_IE_SERVICES** ;
49 * CONSIDER: remove index atributes, and add to summary*;
50 proc sql;
51 create table /*primbndl.*/all_ie_services_1 as
52 select
53 ie.bundle_id,
54 ie.bid_grp_2,
55 ie.index_adm_dt,
56 ie.index_dis_dt,
57 ie.stus_cd as index_stus_cd,
58 ie.src_adms as index_src_adms,
59 ie.index_provider,
60 ie.index_at_npi,
61 ie.index_op_npi,
62 ie.index_prin_dx,
63 ie.index_prin_px,
64 ie.index_drg,
65 ie.model_base,
66 ie.qual_drg,
67 ie.condition_hci3,
68 ie.qual_dis_dt,
69 svc.file_type,
70 svc.row_id,
71 svc.claim_number,
72 svc.row_id as lineitem,
73 svc.provider,
74 svc.prfnpi,
75 svc.at_npi,
76 svc.op_npi,
77 svc.adj_pmt as allowed_amt,
78 svc.std_amt as price_std_amt,
79 svc.from_dt as from_dt,
80 svc.thru_dt as thru_dt,
81 svc.drg_cd,
82 svc.prin_dx,
83 case
84 /* when svc.row_id = ie.bundle_id then 1*/
85 when svc.file_Type = ie.file_type and
86 svc.from_dt between ie.index_adm_dt and ie.index_dis_dt and
87 svc.thru_dt <= index_dis_dt then 1 /**/
88 when svc.file_type = 'IP' and
89 put(put(substr(svc.provider,3,4), $prov_type_cd.), $prov_type_cat.) in
89 ! ('Short Term', 'CAH', 'Psych.')
90 then 2 /* NB: Includes transfer from */
91 when svc.file_type = 'IP' and
92 put(put(substr(svc.provider,3,4), $prov_type_cd.), $prov_type_cat.) in
92 ! ('Rehab.')
93 then 3
94 when svc.file_type = 'IP' then 4
95 when svc.file_type = 'SN' then 5
96 when svc.file_type = 'HH' then 6
97 else 7 end as sub_setting,
98 case when svc.from_dt < ie.index_adm_dt then svc.from_dt - ie.index_adm_dt /*Pre*/
3 The SAS System 11:05 Thursday, May 17, 2012
99 when ie.index_adm_dt <= svc.from_dt < ie.index_dis_dt and svc.thru_dt <=
99 ! ie.index_dis_dt then . /*During*/
100 when svc.from_dt >= ie.index_dis_dt then svc.from_dt - ie.index_dis_dt /*Post*/
101 else . end /*ERROR*/ as days_post /*TO DO - create format for period(s)*/
102 from
103 primbndl.index_events (where = (BID_GRP_2 BETWEEN "&&first_bene&iter." and
103 ! "&&last_bene&iter.")) ie
104 left join
105 bndlrin.services (keep = row_id file_type bid_grp_2 claim_number /*lineitem*/
105 ! adj_pmt std_amt from_dt thru_dt drg_cd provider prfnpi at_npi op_npi prin_dx pmtdnlcd
106 where = (BID_GRP_2 BETWEEN "&&first_bene&iter." and
106 ! "&&last_bene&iter." and
107 (file_type in ('PB','DM') and '1' le pmtdnlcd le '9' or
108 file_type not in ('PB','DM') and pmtdnlcd = '')
109 )
110 ) svc
111 on svc.bid_grp_2 = ie.bid_grp_2 and
112 (svc.from_dt between (ie.index_adm_dt - 3) and (ie.index_dis_dt + 180 ))
113 where svc.from_dt >= ie.index_adm_dt or svc.provider = ie.index_provider ;
114 quit ;
115
116 * For each non-inst. claim, determine whether it occurred during inst. stay * ;
117 proc sql ;
118 create table settings (index = (row_id)) as
119 select
120 ie.bundle_id,
121 ie.row_id,
122 min(inst.sub_setting) as setting
123 from
124 all_ie_services_1 (keep = bundle_id row_id sub_setting from_dt
125 where = (sub_setting = 7 ) ) ie
126 inner join
127 all_ie_services_1 (keep = bundle_id sub_setting from_dt thru_dt
128 where = (sub_setting ne 7 ) ) inst
129 on
130 ie.bundle_id = inst.bundle_id and
131 ie.from_dt between inst.from_dt and inst.thru_dt /*CONSIDER: modify to reduce
131 ! overlap possibilities?*/
132 group by ie.bundle_id, row_id ;
133 quit ;
134
135 proc sql ;
136 create table all_ie_services (index = (key=(bundle_id row_id))) as
137 select
138 ie.bundle_id,
139 ie.model_base,
140 ie.condition_hci3,
141 ie.index_adm_dt,
142 ie.index_dis_dt,
143 case when setting = 1 then 0
144 when ie.sub_setting = 2 and put(strip(ie.condition_hci3)||strip(drg_cd),
144 ! $fmt_drg_excl.) = '1' then 1
145 when ie.file_type in ('OP', 'PB', 'DM') and
4 The SAS System 11:05 Thursday, May 17, 2012
145 ! put(strip(ie.condition_hci3)||'-'||strip(ie.prin_dx), $fmt_dx_excl.) = '1' then 1
146 when ie.file_type in ('OP', 'PB', 'DM') then 0 /*TO DO: Add HH Part B when that
146 ! flag is available.*/
147 else 0 end as flag_excl,
148 case
149 when ie.sub_setting ne 7 then ie.sub_setting
150 when st.setting is not missing then st.setting
151 when st.setting is missing then 7
152 else 99 end as setting,
153 case
154 when ie.sub_setting ne 7 then 1
155 else 2 end as prov_setting,
156 ie.bid_grp_2,
157 ie.index_stus_cd,
158 ie.index_src_adms,
159 ie.index_provider,
160 ie.index_at_npi,
161 ie.index_op_npi,
162 ie.index_prin_dx,
163 ie.index_prin_px,
164 ie.index_drg,
165 ie.qual_drg,
166 ie.qual_dis_dt,
167 ie.file_type,
168 ie.row_id,
169 ie.claim_number,
170 ie.lineitem,
171 ie.provider,
172 ie.prfnpi,
173 ie.at_npi,
174 ie.op_npi,
175 ie.allowed_amt,
176 ie.price_std_amt,
177 ie.from_dt,
178 ie.thru_dt,
179 ie.drg_cd,
180 ie.prin_dx,
181 ie.days_post
182 from
183 all_ie_services_1 ie
184 left join
185 settings st
186 on
187 ie.bundle_id = st.bundle_id and
188 ie.row_id = st.row_id ;
189 quit ;
190
191 proc sql;
192 create table code_class (index = (key=(bundle_id row_id setting))) as
193 select
194 svc.bundle_id,
195 svc.setting,
196 svc.prov_setting,
5 The SAS System 11:05 Thursday, May 17, 2012
197 svc.condition_hci3,
198 svc_cd.row_id,
199 svc_cd.code_type,
200 svc_cd.code_loc,
201 svc_cd.code_value,
202 case
203 when code_type = 'Dx' and put(strip(code_value)||strip(svc.condition_hci3),
203 ! $fmt_tc_dx_trig.) in ('t', 'c')
204 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_dx_trig.)
205 when code_type = 'Px' and put(strip(code_value)||strip(svc.condition_hci3),
205 ! $fmt_tc_px_trig.) in ('t', 'c')
206 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_px_trig.)
207 when code_type = 'CPT' and put(strip(code_value)||strip(svc.condition_hci3),
207 ! $fmt_tc_cpt_trig.) in ('t', 'c')
208 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_cpt_trig.)
209 when code_type = 'Dx' and put(strip(code_value)||strip(svc.condition_hci3),
209 ! $fmt_tc_dx_ccs.) in ('t', 'c')
210 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_dx_ccs.)
211 when code_type = 'Px' and put(strip(code_value)||strip(svc.condition_hci3),
211 ! $fmt_tc_px_ccs.) in ('t', 'c')
212 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_px_ccs.)
213 else 'o' end as svc_cat,
214 case
215 when code_type = 'Dx' and put(strip(code_value)||strip(svc.condition_hci3),
215 ! $fmt_tc_dx_trig_rf.) ne 'XXX'
216 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_dx_trig_rf.)
217 when code_type = 'Px' and put(strip(code_value)||strip(svc.condition_hci3),
217 ! $fmt_tc_px_trig_rf.) ne 'XXX'
218 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_px_trig_rf.)
219 when code_type = 'CPT' and put(strip(code_value)||strip(svc.condition_hci3),
219 ! $fmt_tc_cpt_trig_rf.) ne 'XXX'
220 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_cpt_trig_rf.)
221 when code_type = 'Dx' and put(strip(code_value)||strip(svc.condition_hci3),
221 ! $fmt_tc_dx_ccs_rf.) ne 'XXX'
222 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_dx_ccs_rf.)
223 when code_type = 'Px' and put(strip(code_value)||strip(svc.condition_hci3),
223 ! $fmt_tc_px_ccs_rf.) ne 'XXX'
224 then put(strip(code_value)||strip(svc.condition_hci3), $fmt_tc_px_ccs_rf.)
225 else '' end as pac_rf
226 from
227 all_ie_services svc
228 left join
229 bndlrin.service_codes (where = (BID_GRP_2 BETWEEN "&&first_bene&iter." and
229 ! "&&last_bene&iter.")) svc_cd
230 on
231 svc.row_id = svc_cd.row_id
232 where cats(svc_cd.code_value) not in ('','.');
233 quit ;
234
235
236
237 data service_class ;
238 set code_class (drop=pac_rf);
6 The SAS System 11:05 Thursday, May 17, 2012
239 by bundle_id row_id setting prov_setting ;
240
241 retain with_compl cat_mem ;
242 if first.row_id then do ;
243 with_compl = 0 ;
244 cat_mem = '' ;
245 end ;
246 if setting = 1 and prov_setting = 1 then do ;
247 if first.row_id then with_compl = 0 ;
248 if svc_cat='c' then with_compl = 1 ;
249 if last.setting then do ;
250 svc_cat = 't' ;
251 output ;
252 end ;
253 end ;
254 else if prov_setting = 1 then do ;
255 if first.row_id then with_compl = 0 ;
256 if code_type = 'Dx' and code_loc = 'P' then cat_mem = svc_cat ;
257 if svc_cat='c' then with_compl = 1 ;
258 if last.setting then do ;
259 svc_cat = cat_mem ;
260 if svc_cat = 'c' then with_compl = 0 ;
261 output ;
262 end ;
263 end ;
264 else if prov_setting = 2 then do ;
265 if svc_cat = 'c' then cat_mem = 'c' ;
266 else if svc_cat = 't' and cat_mem ne 'c' then cat_mem = 't' ;
267 else if cat_mem not in ('t', 'c') then cat_mem = 'o' ;
268 if last.setting then do ;
269 svc_cat = cat_mem ;
270 output ;
271 end ;
272 end ;
273
274 drop code_loc code_type code_value cat_mem setting condition_hci3;
275 run;
276
277 data all_ie_services ;
278 merge
279 all_ie_services
280 service_class ;
281 by bundle_id row_id ;
282 run ;
283
284 /* All IP Acute Readmissions are categorized as PAC by logic
285 All professional claims during IP Acute Readmissions are categorized as PAC by
285 ! logic
286 - tag svc_cat='c' for IP Acute Readmission and Prof within that readmit stay
287 - create PAC RF for IP Acute Readmission prof within that readmit stay
288 */
289 proc sql;
290 create table all_ie_services(drop=svc_cat_orig) as
7 The SAS System 11:05 Thursday, May 17, 2012
291 select a.*,
292 case when a.file_type='IP' and a.setting=2 and a.prov_setting=1 and a.flag_excl=0
292 ! then 'c'
293 when r.row_id ne . then 'c'
294 else svc_cat_orig
295 end as svc_cat,
296 r.row_id as ipacute_readmit_row_id
297 from all_ie_services(rename=(svc_cat=svc_cat_orig)) a left join
298 all_ie_services(keep=bundle_id file_type setting prov_setting flag_excl from_dt
298 ! thru_dt row_id
299 where=(file_type='IP' and setting=2 and prov_setting=1 and flag_excl=0)) r
300 on a.bundle_id=r.bundle_id and a.setting ne 1 and a.prov_setting=2 and r.from_dt
300 ! le a.from_dt le r.thru_dt;
301
302 create view v_row_with_pacrf as
303 select distinct bundle_id, row_id, svc_cat
304 from code_class
305 where svc_cat='c';
306
307 create view v_readmit_pacrf as
308 select a.bundle_id, a.setting, a.prov_setting, a.condition_hci3, a.row_id,
309 'Lgc' length 3 as code_type, 'Logic' length 5 as code_value, 'c' as svc_cat,
309 ! 'READM' length 6 as pac_rf
310 from all_ie_services(keep=bundle_id setting prov_setting condition_hci3 row_id
310 ! ipacute_readmit_row_id file_type flag_excl
311 where=(setting ne 1 and prov_setting=2 and ipacute_readmit_row_id ne . or
312 file_type='IP' and setting=2 and prov_setting=1 and flag_excl=0
313 )) a left join
314 v_row_with_pacrf b on a.bundle_id=b.bundle_id and a.row_id=b.row_id
315 where b.svc_cat ne 'c';
316 quit;
317
318 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
319 ** Close Iterative Process **;
320 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
321
322 %if &iter. = 1 %then %do ;
323 data primbndl.all_ie_services (compress = yes) ;
324 set all_ie_services ;
325 run ;
326 data primbndl.pac_codes;
327 set code_class v_readmit_pacrf;
328 run ;
329
330 * Redirect log * ;
331 proc printto log = constlog new ;
332 run ;
333 %end ;
334 %else %do ;
335 proc append base = primbndl.all_ie_services
336 new = all_ie_services ;
337 run ;
338 proc append base = primbndl.pac_codes
8 The SAS System 11:05 Thursday, May 17, 2012
339 new = code_class;
340 run ;
341 proc append base = primbndl.pac_codes
342 new = v_readmit_pacrf force;
343 run;
344 * Put iteration count to log, then redirect log to file again * ;
345 proc printto ; run ;
346
347 %put Now finishing iteration &iter. of &num_iter. ;
348
349 proc printto log = constlog ;
350 run ;
351 %end ;
352
353 *%run_times_append(PacesOut, Iteration &iter_size.);
354
355 %END ;
356 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
357 ** End of Iterative Process **;
358 *^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
359
360
361 proc printto ; run ;
362
363 *******************************************************;
364 ** ADD INDEXES **;
365 *******************************************************;
366 * ;
367
368 proc datasets library = primbndl nolist ;
369 modify all_ie_services ;
370 index create row_id ;
371 index create bid_grp_2 ;
372 index create bundle_id;
373 quit ;
374
375 %MEND Get_all_services ;
376
377 %Get_all_services(&chunk_size.) ;
ERROR: Libname BNDLRIN is not assigned.
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
377:192 377:138
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
WARNING: Apparent symbolic reference NUM_ITER not resolved.
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric
operand is required. The condition was: &num_iter.
9 The SAS System 11:05 Thursday, May 17, 2012
ERROR: The %TO value of the %DO ITER loop is invalid.
ERROR: The macro GET_ALL_SERVICES will stop executing.
378
379
380 GOPTIONS NOACCESSIBLE;
381 %LET _CLIENTTASKLABEL=;
382 %LET _CLIENTPROJECTPATH=;
383 %LET _CLIENTPROJECTNAME=;
384 %LET _SASPROGRAMFILE=;
385
386 ;*';*";*/;quit;run;
387 ODS _ALL_ CLOSE;
388
389
390 QUIT; RUN;
391