anujmehta Tracker
https://communities.sas.com/kntur85557/tracker
anujmehta TrackerSun, 10 Nov 2024 14:35:10 GMT2024-11-10T14:35:10ZQuestion about Nested Random Intercept in Proc Glimmix
https://communities.sas.com/t5/Statistical-Procedures/Question-about-Nested-Random-Intercept-in-Proc-Glimmix/m-p/948601#M47437
<P>I have a question about interpreting the estimates for a nested random intercept using proc glimmix. We are interested in understanding racial variation in mortality within a hospital and comparing across hospitals. We want estimates for each race within each hospital or how much each race deviates from the hospital estimate. the key variables are the binary outcome <EM>died, </EM>racial identity <EM>race3 </EM>(4 level categorical variable), and hospital id <EM>dshospid, </EM>and multiple clinical variables for risk-adjustment (<EM>var1-var10)</EM>. the code we used is </P><P> </P><P>proc glimmix data=dataset method=laplace;</P><P>class dshospid race3; </P><P>model died (event='1') = var1 var2 var3 . . . var10 / dist=binary link=logit solution;</P><P>random intercept / subject=dshospid type=un s;</P><P>random intercept / subject=race3(dshospid) type=un s;</P><P>run;</P><P> </P><P>The random intercept output looks like:</P><P> </P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anujmehta_0-1729613281693.png" style="width: 456px;"><img src="https://communities.sas.com/t5/image/serverpage/image-id/101697i549BA56ADB123786/image-dimensions/456x574?v=v2" width="456" height="574" role="button" title="anujmehta_0-1729613281693.png" alt="anujmehta_0-1729613281693.png" /></span></P><P> </P><P>My question is about how we should interpret the nested random intercept output. In my view, the nested random intercepts (race3(DSHOSPID)) values show how much each racial identity deviates from the hospital estimate. The key question is should these nested random intercept values sum to zero? </P><P> </P>Tue, 22 Oct 2024 16:10:56 GMThttps://communities.sas.com/t5/Statistical-Procedures/Question-about-Nested-Random-Intercept-in-Proc-Glimmix/m-p/948601#M47437anujmehta2024-10-22T16:10:56ZEstimate or contrast statement with proc glimmix
https://communities.sas.com/t5/SAS-Programming/Estimate-or-contrast-statement-with-proc-glimmix/m-p/948113#M371035
<P>I have a fairly simple question. I am using proc glimmix to compare the odds of death (binary outcome) of across several different levels a categorical variable ( call it <EM>cat</EM> with 4 levels 1, 2, 3, 4), adjusting for several clinical variables (<EM>var1-var4</EM>) and clustering by <EM>hospital</EM>. In the class statement, i can specify the reference level for <EM>cat (</EM>e.g., level 1) which will lead to estimates for 2 v 1, 3 v 1, and 4 v 1 which can be converted to odds ratios (the primary outcome we want to publish).</P><P> </P><P>proc glimmix data=model;</P><P>class hospital cat (ref=first);</P><P>model death (event='1') = cat var1 var2 var3 var4 / dist=binary link=logit solution;<BR />random intercept /subject=hospital; run; </P><P> </P><P>However, we are interested in a variety of comparisons (e.g. 3 v 2, 3 v 4, 1 v 3, etc.). Again, we ideally want exponentiated values (odds ratios) and we do not want to have to run the model multiple times with different reference levels. I think the estimate statement could get me where i want to go but I am having trouble coding it properly as I am not so sure of the order of the categories when i define a reference level or when i dont define a reference level. </P><P> </P><P>would the following estimate statements generate the correct comparisons:</P><P>estimate '3 v 2' cat 0 -1 1 0/exp cl;</P><P>estimate '3 v 4' cat 0 0 1 -1/exp cl;</P><P>estimate '1 v 3' cat 1 0 -1 0/exp cl;</P><P> </P><P>Also, when using estimate statements does defining a reference level in the class statement (i.e., class hospital cat (ref=first)) impact the estimate statements?</P><P> </P><P>Thanks for thinking about what i hope is a simple question.</P><P> </P>Fri, 18 Oct 2024 18:36:36 GMThttps://communities.sas.com/t5/SAS-Programming/Estimate-or-contrast-statement-with-proc-glimmix/m-p/948113#M371035anujmehta2024-10-18T18:36:36ZRe: Help with proc transpose
https://communities.sas.com/t5/SAS-Programming/Help-with-proc-transpose/m-p/932013#M366653
<P>Thanks so much. The output is not exactly what i want. The data is structured as is structured exactly as you indicated but with 9 million observations and a patient ID. </P><P> </P><PRE><CODE class="">data temp;
input patientid surge cmr_aids cmr_alcohol cmr_anemdef;
datalines;
1 0 0 1 0
2 0 0 1 1
3 0 0 0 1
4 0 1 1 1
5 0 1 1 1
6 0 0 1 0
7 0 1 0 0
8 0 1 0 1
9 1 0 0 0
10 1 0 0 0
11 1 1 1 1
12 1 0 1 0
13 1 1 0 1
14 1 0 0 1
15 1 1 1 0
;
run;
</CODE></PRE><P>i used proc freq with a table statement (cmr_aids cmr_alcohol cmr_anemdef)* surge; to calculate the percentage of each condition in the larger population. </P><P> </P><P>The table i want would be:</P><P> </P><P> Surge=1 Surge=0</P><P>AIDS 0.3 0.3</P><P>Alcohol 4.5 4.1</P><P>Anemia 8.2 8.3</P><P> </P><P> </P><P>where the columns are surge 1 and surge 0, the rows are each condition and the values of the cells are the percentage of patients with each condition within each surge cohort similar to a Table 1 in publications.</P><P> </P><P>Thanks!</P>Wed, 12 Jun 2024 19:20:51 GMThttps://communities.sas.com/t5/SAS-Programming/Help-with-proc-transpose/m-p/932013#M366653anujmehta2024-06-12T19:20:51ZHelp with proc transpose
https://communities.sas.com/t5/SAS-Programming/Help-with-proc-transpose/m-p/931932#M366636
<P>I was hoping I could get some help with creating tables for publication in SAS. I am determining the frequency of several health conditions for two different cohorts (variable called surge). the proc freq code is</P><P><EM>ods output crosstabfreqs=cmr;<BR />proc freq data=***;<BR />table (CMR_AIDS CMR_ALCOHOL CMR_ANEMDEF CMR_AUTOIMMUNE CMR_BLDLOSS CMR_CANCER_LYMPH CMR_CANCER_LEUK<BR />CMR_CANCER_METS CMR_CANCER_NSITU CMR_CANCER_SOLID CMR_CBVD) * surge/nocum norow nopercent; run;</EM></P><P> </P><P>I ods output the results into a dataset and am in the process of trying to convert that dataset into a better table for viewing. </P><P> </P><P>The ods output dataset as it stands after dropping unnecessary columns looks something like this:</P><P><span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="anujmehta_0-1718211790323.png" style="width: 760px;"><img src="https://communities.sas.com/t5/image/serverpage/image-id/97249iFE49F2FEF0EF63C6/image-dimensions/760x361?v=v2" width="760" height="361" role="button" title="anujmehta_0-1718211790323.png" alt="anujmehta_0-1718211790323.png" /></span></P><P>What i want is a table where each row is is one of the conditions (alcohol abuse, deficiency anemias, autoimmune conditions, etc.), the columns are surge 0 and 1, and the values are percent of column frequency. </P><P> </P><P>Anyone have any idea how to do this with proc transpose or another procedure?</P><P> </P>Wed, 12 Jun 2024 17:07:50 GMThttps://communities.sas.com/t5/SAS-Programming/Help-with-proc-transpose/m-p/931932#M366636anujmehta2024-06-12T17:07:50ZHelp with Instrumental Variable approach with proc syslin
https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Help-with-Instrumental-Variable-approach-with-proc-syslin/m-p/804646#M4405
<P>I am attempting to perform an IV analysis to help account for unmeasured confounding in an observational study. Here is the summary of my dataset:</P><P>Outcome: <EM>wage</EM> (continuous value - log transformed)</P><P>Primary exposure/dependent variable: <EM>education</EM> - binary 1/0</P><P>IV: <EM>near</EM>: binary 1/0 (meets all criteria for a reasonable IV</P><P><EM>var1-var8</EM> - covariates/measured confounders all of which are 1/0 indicator variables, not associated with the IV. </P><P>The goal is to estimate the association of <EM>education</EM> and <EM>wage</EM> accounting for measured confounders and also unmeasured confounding via an IV analysis. </P><P>I want to use a 2 SLS approach. I can do a 2 step proc reg approach with the first model regressing <EM>education </EM>on <EM>near. </EM>I can output the predicted values and then use those values in the 2nd step in which i regress <EM>wage </EM>on <EM>pred_education</EM>. </P><P>I am running in some peculiar results when I try this in proc syslin. I want to do it in proc syslin to account for possible correlated error terms across the 2 models and to carry the SE of the estimates for <EM>pred_education</EM> forward into step 2. </P><P>In using proc syslin I use the following syntax with double adjustments for the covariates <EM>var1-var8</EM>:</P><P><STRONG>Approach 1</STRONG></P><P>proc syslin data 2sls;</P><P>endogenous education;</P><P>instruments near; </P><P>stepone: model education = near var1-var8;</P><P>steptwo: model wage = education var1-var8; run;</P><P> </P><P>The model works fine and I get estimates for each model. in the first model, the parameter estimate for <EM>near=</EM>0.067, SE=0.219, p=0.0021<EM>. </EM>In the second model, the parameter estimate for <EM>education</EM> = 0.62, SE=0.2324, p=0.0077. I also get estimates for var1-var8 but i am leaving those out from this post. This is different than if i do a 2 step proc reg although that is not surprising. </P><P>What is surprising is what happened when I tried to adjust for measured confounders in only 1 step with the following code:</P><P> </P><P><STRONG>Approach 2</STRONG></P><P>proc syslin data 2sls;</P><P>endogenous education;</P><P>instruments near; </P><P>stepone: model education = near;</P><P>steptwo: model wage = education var1-var8; run;</P><P> </P><P>in the stepone model, var1-var8 have been eliminated and we only adjust for them in steptwo. When i run this code i get the following estimates:</P><P>stepone: parameter estimate for <EM>near </EM>= 0.1030, SE=0.0226, p<0.0001 [no estimates for var1-var8 as they were not included]</P><P>steptwo: parameter estimate for <EM>education</EM> = 0.62, SE=0.2324, p=0.0077, the same as the first approach with covariate adjustment in both steps. Moreover, the parameter estimates for var1-var8 are the same between approach 1 and 2. </P><P> </P><P>My issue is that if I don't include var1-var8 in stepone I would expect the predictions for <EM>education </EM>to change which should affect the 2nd model in steptwo. My question to the community is why are the results of steptwo in Approach 1 and Approach 2 the same even if stepone is different between the 2.</P><P> </P><P>Any insight would be greatly appreciated. </P><P> </P><P> </P>Tue, 29 Mar 2022 01:46:50 GMThttps://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Help-with-Instrumental-Variable-approach-with-proc-syslin/m-p/804646#M4405anujmehta2022-03-29T01:46:50Z