Using the RMSTREG procedure, I would like to know the group effect adjusting for sex. In the model, the interaction term is also included. The group has two categories, A and B.
The model is intercept+ beta1*group+beta2*sex+beta3*group*sex. For the overall group effect test, the hypothesis is beta1 (group effect in male) = beta1+beta3 (group effect in female)=0. which is same as beta1=beta3=0.
Is there any way to test the hypothesis ( beta1=beta3=0.) in Proc RMSTREG or manually in SAS? Does the estimate statement work for this? 'estimate' is colored in red in my code... I am not sure about the reason. and the ESTIMATE output showed nothing. My SAS version is 9.4.
This is the dataset
data rmst;
input Obs time status group$ Sex$;
cards;
3 49 1 A M
4 70 0 A M
5 31 1 B M
6 28 1 B M
7 56 1 A M
8 70 0 A M
9 35 1 A M
10 35 1 A M
11 42 1 B M
12 70 0 B M
17 35 1 B M
18 35 1 B M
19 45 1 A M
20 63 0 A M
23 33 1 A M
24 33 1 A M
27 31 1 A M
28 45 1 A M
31 45 1 A M
32 35 1 A M
35 63 0 A M
36 63 0 A M
39 28 1 A F
40 54 1 A F
41 52 1 A F
44 42 1 B F
45 47 1 B F
46 28 1 B F
47 28 1 B F
48 70 0 A F
49 70 0 A F
50 70 0 A F
53 70 0 B F
54 28 1 B F
;
run;
Here is the code I tried.
proc rmstreg data=rmst;
class Sex group ;
lsmeans group*Sex/e diff;
estimate group 1 0 Sex*group -1 0 0 0;
model time*status(0) = group|Sex;
run;
Here is the ESTIMATE output.
Thank you!!!
Hello,
Could you sort it out meanwhile?
I don't think you need the ESTIMATE statement
, you need the TEST statement.
Something like :
TEST age1ht=0, age2ht=0;
Koen
Thank you. I sorted out the data and tried the test statement but I got a syntax error message. Is there any way to fix it? or any other suggestions?
Here is the code I used. (I think you meant I need to dummy variables manually and use the test?, here is the reference, https://stats.oarc.ucla.edu/sas/faq/how-can-i-compare-regression-coefficients-across-three-or-more-g... )
data rmst2;
set rmst;
sex_f=.;
sex_m=.;
if Sex='F' then sex_f=1; ELSE sex_f=0;
if Sex='M' then sex_m=1; ELSE sex_m=0;
group_a=.;
group_b=.;
if group='A' then group_a=1;ELSE group_a=0;
if group='B' then group_b=1;ELSE group_b=0;
sfga=sex_f*group_a;
sfgb=sex_f*group_b;
smga=sex_m*group_a;
smgb=sex_m*group_b;
run;
proc rmstreg data=rmst2;
class sex_f sex_m group_a group_b sfga sfgb smga smgb;
model time*status(0) = sex_f sex_m group_a group_b sfga sfgb smga smgb ;
*lsmeans group*Sex/e diff;
test group_a=0,sfga=0 ;
run;
Here is the relevant log.
369 proc rmstreg data=rmst2;
NOTE: PROCEDURE RMSTREG used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
NOTE: The SAS System stopped processing this step because of errors.
370 class sex_f sex_m group_a group_b sfga sfgb smga smgb;
371 model time*status(0) = sex_f sex_m group_a group_b sfga sfgb smga smgb ;
372 *lsmeans group*Sex/e diff;
373 test group_a=0,sfga=0 ;
-
22
76
ERROR 22-322: Syntax error, expecting one of the following: a name, ;, (, *, -, /, :, @,
_CHARACTER_, _CHAR_, _NUMERIC_, |.
ERROR 76-322: Syntax error, statement will be ignored.
374 run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.