BookmarkSubscribeRSS Feed
LaurenMeta
Calcite | Level 5

Hello, I am some what new to SAS and very new to using Proc Glimmix. I recently took a multilevel modeling course and it is new to me. I am working with sample weights and I am confused. I am having a hard time understanding my output. I am also wondering if my code is correct. I wanted to run a two level model. I have state level variables (level two) and I wanted to understand their relationship to Postpartum Depression (level one). Postpartum Depression is binary (yes or no). I also have other health indicators at level one and state level poverty at level 2. Maybe I am confused..but I don't think my code is correct. I would like to have the odds ratios in the output as well. My IV (state level variables at level 2) are categorized as 0=low, 1=med, and 2=high.  I am really stuck and would appreciate any help! I wanted to do at random effects and fixed effects ( for the state level variables). . I am wondering if it correct and also if I wanted to do all fixed effects what should I enter. I an introductory course and I am still learning. However, the course was not in SAS, so I am really confused.  Here is my code proc sort data= out1; by FIPS; run; proc summary data=out1 print; by FIPS; var wtanal; output out=intermediate uss=sumsqw sum=sumw n=nj; run; proc means; run; data LaurenFinal; merge out1 intermediate; by FIPS; aw=wtanal/(sumw/nj); bw=wtanal/(sumsqw/sumw); run; proc means; run; proc contents data=out1; run; proc freq data=LaurenFinal; tables state FIPS; run; /*method A*/ Proc glimmix noclprint data=LaurenFinal method=quad; class FIPS; model PostpartumDepression= /dist=binomial link=probit obsweight=aw solution; random intercept /sub=FIPS; covtest 'var (FIPS)=0' 0.; run; /*Method b*/ Proc glimmix noclprint data=LaurenFinal method=quad; class FIPS; model PostpartumDepression= /dist=binomial link=probit obsweight=bw solution; random intercept /sub=FIPS; covtest 'var (FIPS)=0' 0.; run; THIS IS WHAT I HAVE NOW, BUT I DON'T THINK IT'S RIGHT: Title' PPD overall BW Incarceration model method A2 Random'; Proc glimmix noclprint data=LaurenFinalPhD method=quad; class FIPS; class BWIncRatioAVG_3/REF=First; model PostpartumDepression (event='1')= /dist=binary Oddsratio link=logit obsweight=aw solution; random intercept BWIncRatioAVG_3 /sub=FIPS CL; covtest 'var (FIPS)=0' 0.; run; Title' PPD overall BW Incarceration model method b Random'; Proc glimmix noclprint data=LaurenFinalPhD method=quad; class FIPS; class BWIncRatioAVG_3/REF=First; model PostpartumDepression= /dist=binomial Oddsratio link=logit obsweight=bw solution; random intercept BWIncRatioAVG_3 /sub=FIPS CL; covtest 'var (FIPS)=0' 0.; run; /*Use fixed for models. this is the crude model*/ Title' PPD overall BW Incarceration model method A2 fixed'; Proc glimmix noclprint data=LaurenFinalPhD method=quad; class FIPS; class BWIncRatioAVG_3/REF=First; model PostpartumDepression (event='1')=BWIncRatioAVG_3 /dist=binary Oddsratio link=logit obsweight=aw solution; random intercept /sub=FIPS CL; covtest 'var (FIPS)=0' 0.; run; Title' PPD overall BW Incarceration model method b fixed'; Proc glimmix noclprint data=LaurenFinalPhD method=quad; class FIPS; class BWIncRatioAVG_3/REF=First; model PostpartumDepression (event='1')=BWIncRatioAVG_3 /dist=binary Oddsratio link=logit obsweight=bw solution; random intercept /sub=FIPS CL; covtest 'var (FIPS)=0' 0.; run; Thank you so much!!

1 REPLY 1
SteveDenham
Jade | Level 19

Hi @LaurenMeta ,

 

Having your code in text format makes it very difficult to follow or even read in some cases.  Could you repost, with your code in the "Insert SAS code" box?  The icon that looks like SteveDenham_0-1615470700238.pngis what will trigger that.  The </> icon will also work.

 If you have issues with PROC GLIMMIX, please also show your complete log file, so that we can trace any errors back to the source.

SteveDenham

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 355 views
  • 0 likes
  • 2 in conversation