BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Callam1
Obsidian | Level 7
Is the code below correct to obtain robust standard errors for a regression where the outcome variable is binary (0,1) and the independent variables are categorical and binaries? The dataset is at individual level: one unique person (identified by ID) per row. Is it right to use ‘cluster id’ to obtain robust S.E.? Is it ok to use individual weights together with the ‘cluster id’ option as done below?

proc surveyreg data=matched_dataset;
cluster id;
class is_treated(ref='0') categorical_covariates;
model outcome_variable = is_treated covariate1 covariate2 …/ CLPARM solution;
weight _MATCHWGT_;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
sbxkoenk
SAS Super FREQ

Hello,

 

If you only want robust standard errors, you can indeed specify the cluster variable to be the identifier variable.

Like here:

 

proc surveyreg data=yourdata;
cluster id;
model y = x1 x2 x3 / covb;
run; QUIT;

And, of course, you can specify a WEIGHT statement (if the weights are sampling weights).

If you do not specify a WEIGHT statement or a REPWEIGHTS statement, PROC SURVEYREG assigns all observations a weight of one.

 

But are you sure you want PROC SURVEYREG??
Keep in mind that your outcome variable is binary (0,1).
PROC SURVEYLOGISTIC seems more appropriate then anyway.

 

Koen

View solution in original post

2 REPLIES 2
sbxkoenk
SAS Super FREQ

Hello,

 

If you only want robust standard errors, you can indeed specify the cluster variable to be the identifier variable.

Like here:

 

proc surveyreg data=yourdata;
cluster id;
model y = x1 x2 x3 / covb;
run; QUIT;

And, of course, you can specify a WEIGHT statement (if the weights are sampling weights).

If you do not specify a WEIGHT statement or a REPWEIGHTS statement, PROC SURVEYREG assigns all observations a weight of one.

 

But are you sure you want PROC SURVEYREG??
Keep in mind that your outcome variable is binary (0,1).
PROC SURVEYLOGISTIC seems more appropriate then anyway.

 

Koen

Callam1
Obsidian | Level 7
Thank you

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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
  • 2 replies
  • 908 views
  • 3 likes
  • 2 in conversation