BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
madjei
Calcite | Level 5

Hi,

 

I'm trying to compare the survival estimates of multiple groups to a control group. Eg I have groups A, B, C, and D. I want to see if there is a difference between A vs BCD.  This is the current code I have, however, I don't want a complete pairwise comparison (A v B, B v D, etc) just the control compared to the combined 3 groups (A vs BCD).

 

proc lifetest plots=survival (atrisk) data=E2y; where AGE > 18;
time PTIMEYrsT10y*PSTATUST10y(0);
strata Group/adjust=sidak;
label PTIMEYrsT10y='Years Post Treatment';
run;

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

I would start with a custom format that assigns the values of the variable into the groups needed.

Proc format;
value GroupA_BCD
'A' = 'A'
'B','C','D' = 'BCD'
;
run;

Then modify the code to use the format.

proc lifetest plots=survival (atrisk) data=E2y; where AGE > 18;
time PTIMEYrsT10y*PSTATUST10y(0);
strata Group/adjust=sidak;
label PTIMEYrsT10y='Years Post Treatment';
format group $GroupA_BCD. ;
run;

Formats are a very flexible way to create groups "on the fly". The analysis, reporting and graphing procedures will recognize groups formed using formats from underlying values.

So you could make multiple formats and just change the format for different analysis.

Note that if the values are character the name of the format, on the VALUE statement, starts with a $. Since formats treat digits at the end as the number of display positions you cannot end the name of the format in a digit and otherwise have the same basic naming conventions as variable names, start with a letter or _ and follow with letters, digits (except at the end) or the _ .

View solution in original post

3 REPLIES 3
ballardw
Super User

I would start with a custom format that assigns the values of the variable into the groups needed.

Proc format;
value GroupA_BCD
'A' = 'A'
'B','C','D' = 'BCD'
;
run;

Then modify the code to use the format.

proc lifetest plots=survival (atrisk) data=E2y; where AGE > 18;
time PTIMEYrsT10y*PSTATUST10y(0);
strata Group/adjust=sidak;
label PTIMEYrsT10y='Years Post Treatment';
format group $GroupA_BCD. ;
run;

Formats are a very flexible way to create groups "on the fly". The analysis, reporting and graphing procedures will recognize groups formed using formats from underlying values.

So you could make multiple formats and just change the format for different analysis.

Note that if the values are character the name of the format, on the VALUE statement, starts with a $. Since formats treat digits at the end as the number of display positions you cannot end the name of the format in a digit and otherwise have the same basic naming conventions as variable names, start with a letter or _ and follow with letters, digits (except at the end) or the _ .

madjei
Calcite | Level 5
Awesome, thank you
madjei
Calcite | Level 5
Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 413 views
  • 0 likes
  • 2 in conversation