BookmarkSubscribeRSS Feed
MGhab
Obsidian | Level 7

Hi there. I am performing surveyreg and mianalyze after multiple imputation. Originally, I wrote this code successfully and ran the analyses. But now I need to dummy-code all of my nominal categorical variables and then run the analysis again. 

I managed to dummy-code and then run a simple regression only (below), but I'm not sure how to integrate all of these commands (dummy coding, multiple imputation, regression, mianalyze). I'll include the main analysis (regression) code first, and then the dummy-coding code that I've pieced together so far. 

I have not dummy coded in SAS before and I am relatively new to MI and MIANALYZE. I would be very grateful for any assistance. Thank you!

 

Here is a legend of the kinds of variables.

The nominal categorical variables are: econcomp, O1_4cat, t1_pp_racialized, t1_pp_immigrant, t1_pp_indig

Continuous: ratio2019, CESD10_resc

 

REGRESSION AND MIANALYZE AFTER MI :

 

``` proc surveyreg data=outfcs; domain include; 
weight covid_weights;
by _imputation_ ; title3 "Regression. IV=econ. DV=T1_CESD imputed data"; class econcomp (ref="0") t1_1_6cat (ref="1") a14_5cat18 (ref="1") O1_4cat (ref="1") t1_pp_racialized (ref="0") t1_15_4cat (ref="4") t1_pp_immigrant (ref="0") t1_pp_indig (ref="0") a9_province (ref="1"); MODEL t1_CESD = econcomp t1_1_6cat a14_5cat18 O1_4cat t1_pp_racialized t1_15_4cat t1_pp_immigrant t1_pp_indig a9_province ratio2019 CESD10_resc CESD10_resc*econcomp / solution adjrsq clparm COVB; ods output parameterestimates = regparms; proc print data= regparms; run; proc sort data=regparms; by include _imputation_; run; data regparms2; set regparms; parameter=compress(parameter); run; proc mianalyze parms=regparms2;
by include;
weight covid_weights; title3 'MI Analyze Econ.Depression'; modeleffects intercept econcomp1 econcomp2 t1_1_6cat2 t1_1_6cat3 t1_1_6cat4 t1_1_6cat5 t1_1_6cat6 a14_5cat182 a14_5cat183 a14_5cat184 a14_5cat185 O1_4cat2 O1_4cat3 O1_4cat4 t1_pp_racialized1 t1_15_4cat1 t1_15_4cat2 t1_15_4cat3 t1_pp_immigrant1 t1_pp_indig1 a9_province2 a9_province3 a9_province4 a9_province5 a9_province6 a9_province7 a9_province8 a9_province9 a9_province10 ratio2019 CESD10_resc CESD10_resc*econcomp1 CESD10_resc*econcomp2 ; run;

 

 

 DUMMY CODING: 

 

proc glmmod data=tpcmergedcov outdesign=GLMDesign outparm=GLMParm NOPRINT; 
class econcomp t1_1_6cat a14_5cat18 O1_4cat t1_pp_racialized t1_15_4cat t1_pp_immigrant t1_pp_indig a9_province ; 
MODEL t1_CESD = econcomp t1_1_6cat a14_5cat18 O1_4cat t1_pp_racialized t1_15_4cat t1_pp_immigrant t1_pp_indig a9_province ratio2019 CESD10_resc CESD10_resc*econcomp; weight covid_weights; run; 
proc print data= GLMDesign; run; 
proc print data=GLMParm; run; ods graphics off; 

 

 

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 0 replies
  • 263 views
  • 1 like
  • 1 in conversation