-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHIS_72_BinomRegress.sas
277 lines (245 loc) · 10.6 KB
/
CHIS_72_BinomRegress.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
%LET _CLIENTTASKLABEL='CHIS_72_BinomRegress';
%LET _CLIENTPROCESSFLOWNAME='CHIS_Execution';
%LET _CLIENTPROJECTNAME='AsthmaAnalysis.egp';
%LET _SASPROGRAMFILE='';
%LET _SASPROGRAMFILEHOST='';
GOPTIONS ACCESSIBLE;
/*************************************************************************************
** Project Name : Secondary Research of Asthma Hospitalizations **
** Masters of Science in Business Analytics Capstone Project **
** March / April 2019 **
** Author : Matthew C. Vanderbilt **
** MSBA Candidate & NU Scholar, National University **
** Director of Fiscal Affairs, Department of Medicine, **
** UC San Diego School of Medicine **
** =============================================================================== **
** Date Created : 24 April 2019 14:54 **
** Program Name : CHIS_72_BinomRegress **
** Purpose : Performs Binomial Regression Model B - Census **
** Note : Capitalized values represent SAS commands and unadjusted **
** variables; lower-case variables represent study-created **
** variables. **
** **
*************************************************************************************/
/* GLOBAL VARIABLES */
* Determine File Path for SAS EGP;
%LET localProjectPath = %SYSFUNC(SUBSTR(%SYSFUNC(DEQUOTE(&_CLIENTPROJECTPATH)), 1, %LENGTH(%SYSFUNC(DEQUOTE(&_CLIENTPROJECTPATH))) - %LENGTH(%SYSFUNC(DEQUOTE(&_CLIENTPROJECTNAME))) ));
/* MASTER LIBRARY */
LIBNAME CHIS "&localProjectPath.CHIS";
/* Determine PDF Password */
* Pull PDF Password from Text;
FILENAME scrPath "&localProjectPath.PDFPassword.txt";
DATA _NULL_;
LENGTH text $265;
RETAIN text '';
INFILE scrPath FLOWOVER DLMSTR='//' END=last;
INPUT;
text = CATS(text,_INFILE_);
IF last THEN CALL SYMPUT('rawpath',text);
RUN;
%LET pdfPassword = %SYSFUNC(TRIM(%SYSFUNC(DEQUOTE(&rawpath))));
/* DEFINE GLOBAL OPTIONS */
ODS GRAPHICS OFF;
OPTIONS PDFPASSWORD=(owner="&pdfPassword");
OPTIONS PDFSECURITY=HIGH;
/* APPLY CHIS FORMATS */
OPTIONS fmtsearch=(CHIS);
/* DEFINE FORMATS FOR NEWLY RECODED VARIABLES */
PROC FORMAT LIBRARY=CHIS;
VALUE frace 1 = 'Latino'
3 = 'American Indian / Alaska Native'
4 = 'Asian'
5 = 'African American'
6 = 'White'
9 = 'Multiracial / Other'
;
VALUE fchildhh 1 = 'Children in HH'
2 = 'No Children in HH'
;
VALUE fnonasthmatic 1 = '1 Non-Asthmatic'
2 = '2 Current Asthmatic'
;
VALUE flateradult 1 = 'Later Adult'
2 = 'Young / Middle Aged'
;
VALUE frcbmi 0 = 'Not Overweight 0-24.99'
3 = 'Overweight 25.0-29.99'
4 = 'Obese 30.0+'
;
VALUE fpfpl 1 = '0-99% FPL'
5 = '100% FPL and Above'
;
RUN;
/* CREATE BINOMIAL ANALYSIS DATASET WITH RECODED VARIABLES */
DATA CHIS.CHIS_DATA_BINOMIAL_BC;
SET CHIS.CHIS_DATA_FINAL;
analyzeData = 0;
IF asthmastatus IN(1,3) THEN analyzeData = 1;
* Collapse Race/Ethnicity Categories;
race = RACEDF_P1;
IF RACEDF_P1 IN(2,8) THEN race = 9; *Collapse Other with Multiracial;
LABEL race = 'race';
FORMAT race frace.;
* Collapse Family Type to Children-in-Household;
IF famtype IN(1,3) THEN childhh = 2;
IF famtype IN(2,4) THEN childhh = 1;
LABEL childhh = 'Child Household';
FORMAT childhh fchildhh.;
* Invert Asthma Status to Boolean Non-Asthmatic;
nonasthmatic = 1;
IF asthmastatus = 1 THEN nonasthmatic = 2;
LABEL nonasthmatic = 'Non-Asthmatic';
FORMAT nonasthmatic fnonasthmatic.;
* Collapse Tri-Category Age to Dichotomous;
lateradult = 2;
IF agegroup = 3 THEN lateradult = 1;
LABEL lateradult = 'Later Adult';
FORMAT lateradult flateradult.;
* Collapse Underweight/Normal to Single Category;
rcbmi = RBMI;
IF RBMI IN(1,2) THEN rcbmi = 0;
LABEL rcbmi = 'descriptive BMI';
FORMAT rcbmi frcbmi.;
* Collapse FPL to Under vs At Least;
pfpl = POVLL;
IF POVLL IN(2,3,4) THEN pfpl = 5;
LABEL pfpl = 'percentage of FPL';
FORMAT pfpl fpfpl.;
RUN;
/* VALIDATE RECODED DATASET CONTENTS */
ODS PDF FILE="&localProjectPath.CHIS\%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))_PROC-CONTENTS.pdf"
AUTHOR="Matthew C. Vanderbilt"
TITLE="Targeting Reduced Asthma Hospitalizations"
SUBJECT="MS Business Analytics Thesis"
STYLE=StatDoc;
PROC CONTENTS DATA=CHIS.CHIS_DATA_BINOMIAL_BC (WHERE=(analyzeData=1)) VARNUM;
TITLE1 "%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))";
TITLE2 "%SYSFUNC(TRIM(&SYSDSN))";
TITLE3 "PROC CONTENTS - %LEFT(%QSYSFUNC(DATE(), WORDDATE18.))";
RUN;
ODS PDF CLOSE;
/* TEST MODEL VARIABLES FOR MULTICOLLINEARITY */
ODS PDF FILE="&localProjectPath.CHIS\%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))_PROC-REG.pdf"
AUTHOR="Matthew C. Vanderbilt"
TITLE="Targeting Reduced Asthma Hospitalizations"
SUBJECT="MS Business Analytics Thesis"
STYLE=StatDoc;
PROC REG DATA=CHIS.CHIS_DATA_BINOMIAL_BC (WHERE=(analyzeData=1));
TITLE1 "%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))";
TITLE2 "%SYSFUNC(TRIM(&SYSDSN))";
TITLE3 "PROC REG - %LEFT(%QSYSFUNC(DATE(), WORDDATE18.))";
MODEL nonasthmatic = SRSEX
lateradult
CITIZEN2
race
childhh
pfpl
INS
/ TOL VIF COLLIN;
;
RUN;
ODS PDF CLOSE;
/* PERFORM WEIGHTED UNIVARIATE ANALYSIS FOR RECODED BINOMIAL DATASET */
ODS PDF FILE="&localProjectPath.CHIS\%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))_PROC-SURVEYFREQ.pdf"
AUTHOR="Matthew C. Vanderbilt"
TITLE="Targeting Reduced Asthma Hospitalizations"
SUBJECT="MS Business Analytics Thesis"
STYLE=StatDoc;
ODS GRAPHICS ON / WIDTH=1280px HEIGHT=960;
PROC SURVEYFREQ DATA=CHIS.CHIS_DATA_BINOMIAL_BC VARMETHOD=JACKKNIFE;
TITLE1 "%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))";
TITLE2 "%SYSFUNC(TRIM(&SYSDSN))";
TITLE3 "PROC SURVEYFREQ - %LEFT(%QSYSFUNC(DATE(), WORDDATE18.))";
WEIGHT FNWGT0;
CLUSTER analyzeData;
REPWEIGHT FNWGT1-FNWGT160 / jkcoefs = 1;
TABLES (SRSEX
lateradult
CITIZEN2
race
childhh
pfpl
INS
)*nonasthmatic
/ CHISQ PLOTS=ALL;
RUN;
ODS GRAPHICS OFF;
ODS PDF CLOSE;
/* PERFORM BINOMIAL LOGISTIC REGRESSION */
ODS PDF FILE="&localProjectPath.CHIS\%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))_PROC-SURVEYLOGISTIC.pdf"
AUTHOR="Matthew C. Vanderbilt"
TITLE="Targeting Reduced Asthma Hospitalizations"
SUBJECT="MS Business Analytics Thesis"
STYLE=StatDoc;
PROC SURVEYLOGISTIC DATA=CHIS.CHIS_DATA_BINOMIAL_BC VARMETHOD=JACKKNIFE;
TITLE1 "%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))";
TITLE2 "%SYSFUNC(TRIM(&SYSDSN))";
TITLE3 "PROC SURVEYLOGISTIC - %LEFT(%QSYSFUNC(DATE(), WORDDATE18.))";
WEIGHT FNWGT0;
DOMAIN analyzeData;
REPWEIGHTS FNWGT1-FNWGT160 / jkcoefs = 1;
CLASS nonasthmatic(REF='1 Non-Asthmatic')
SRSEX(REF='Male')
lateradult(REF='Later Adult')
CITIZEN2(REF='Naturalized Citizen')
race(REF='White')
childhh(REF='Children in HH')
pfpl(REF='100% FPL and Above')
INS(REF='No')
;
MODEL nonasthmatic = SRSEX
lateradult
CITIZEN2
race
childhh
pfpl
INS
/ LINK=GLOGIT CTABLE PPROB = (0.852)
CORRB COVB RSQUARE STB
;/*1 - CA Asthma Rate*/
RUN;
ODS PDF CLOSE;
/* PERFORM UNWEIGHTED BINOMIAL LOGISTIC REGRESSION */
ODS PDF FILE="&localProjectPath.CHIS\%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))_PROC-LOGISTIC.pdf"
AUTHOR="Matthew C. Vanderbilt"
TITLE="Targeting Reduced Asthma Hospitalizations"
SUBJECT="MS Business Analytics Thesis"
STYLE=StatDoc;
ODS GRAPHICS ON / WIDTH=1280px HEIGHT=960;
PROC LOGISTIC DATA=CHIS.CHIS_DATA_BINOMIAL_BC (WHERE=(analyzeData=1)) PLOTS=ALL;
TITLE1 "%SYSFUNC(DEQUOTE(&_CLIENTTASKLABEL))";
TITLE2 "%SYSFUNC(TRIM(&SYSDSN))";
TITLE3 "PROC SURVEYLOGISTIC - %LEFT(%QSYSFUNC(DATE(), WORDDATE18.))";
WEIGHT FNWGT0;
CLASS nonasthmatic(REF='1 Non-Asthmatic')
SRSEX(REF='Male')
lateradult(REF='Later Adult')
CITIZEN2(REF='Naturalized Citizen')
race(REF='White')
childhh(REF='Children in HH')
pfpl(REF='100% FPL and Above')
INS(REF='No')
;
MODEL nonasthmatic = SRSEX
lateradult
CITIZEN2
race
childhh
pfpl
INS
/ LINK=GLOGIT CTABLE PPROB = (0.852)
CORRB COVB RSQUARE STB
;/*1 - CA Asthma Rate*/
RUN;
ODS PDF CLOSE;
/* DISABLE SAS GRAPHICS */
ODS GRAPHICS OFF;
QUIT;
GOPTIONS NOACCESSIBLE;
%LET _CLIENTTASKLABEL=;
%LET _CLIENTPROCESSFLOWNAME=;
%LET _CLIENTPROJECTPATH=;
%LET _CLIENTPROJECTPATHHOST=;
%LET _CLIENTPROJECTNAME=;
%LET _SASPROGRAMFILE=;
%LET _SASPROGRAMFILEHOST=;