BookmarkSubscribeRSS Feed
stmaatta
Calcite | Level 5

Hi,

I am trying to do multilevel analysis by using Proc Glimmix and applying this: https://support.sas.com/resources/papers/proceedings15/3430-2015.pdf

Anyhow, I have multiple dichotomous explanatory factors, and I need to specify the reference groups for those. I have used the tips provided here: https://support.sas.com/kb/37/108.html 

and aiming to use the sort option. I have older version of SAS, so setting reference for class (ref=class) is not option. 

My problem is that I have been able to sort right reference groups for most of the explanatory factors, but there are still few left that it is not read right. I have tried to set them with or without descending option and tried different ways to set the right reference group without succeeding. Is there any tips what I could do or try? 

 

Here is example of code. Of this example, all other explanatory factors are read right expect ind_fm and ind_wh. They does not work either then if I define "descending" in the front. 

 

 

proc sort data=od out=New;
by
descending sp
descending im2
am2
school_level
ind_sd
ind_hm
ind_fm
ind_bn 

ind_hw
ind_dp

kK;

run;

 

PROC GLIMMIX DATA=new METHOD=LAPLACE NOCLPRINT
order=data;
CLASS

sp
 im2
am2
school_level
ind_sd
ind_hm
ind_fm
ind_bn 

ind_hw
ind_dp

kK;
MODEL ind_ls (EVENT=LAST) =
sp
 im2
am2
school_level
ind_sd
ind_hm
ind_fm
ind_bn

ind_hw
ind_dp / CL DIST=BINARY
LINK=LOGIT SOLUTION ODDSRATIO (DIFF=FIRST LABEL);
RANDOM INTERCEPT / SUBJECT=kK TYPE=VC SOLUTION CL;
COVTEST / WALD;
run;

 

Thank you for all the help you can provide!

 

 

4 REPLIES 4
sbxkoenk
SAS Super FREQ

Hello,

What version of SAS do you have?
Submit :

%PUT &=sysvlong4;

to find out (and send us what it displays in the LOG).

I think you must have a very old SAS if it does not support

REF=’level’ | FIRST | LAST

on the variables you specify in the CLASS statement.

Use that REF= between brackets right after specification of your dichotomous explanatory variable.
Like here :

CLASS Statement

CLASS variable <(REF= option)> …<variable <(REF= option)>> </ global-options>;


Koen

stmaatta
Calcite | Level 5

Thank you for the reply. My SAS version is 8.3 Update 3 (8.3.3.181) (64-bit).

I tried once again with REF-option in Class statement, and I noticed that it seems to work just fine with dichotomous predictors, but not if I have three classes or more. For instance, I have predictor variable called education, and it has 3 classes (low, middle and high). I would like to use high as my reference category. And when I define it with class ref-option, it sets the middle-class as reference. The same thing happens with other variables that have 3 or more classes (e.g. perceived income, or family living arrangements) It does not recognise the right reference group. Any tips for that?

sbxkoenk
SAS Super FREQ

SAS v8. Phew 😉.
( SAS 9.2 was released in March 2009 )

 

I think the best you can do is recode your levels to a numeric (1,2,3 ...).
Then apply a format to the numbered levels (to see the original string value).

When choosing a reference level, SAS v8 will take the internal value (AFAIR) and it will be the first or the last level (AFAIR).

 

Cheers,

Koen

StatsMan
SAS Super FREQ

The last v8 release was over 20 years ago (March, 2001). There have been many, many advances in mixed models since that release beyond REF= for specifying reference levels for CLASS effects. If you can find a newer release, you will be very happy with the results you get. 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 865 views
  • 1 like
  • 3 in conversation