Hi,
I am calculating an overall 5-year rate for survivors (#ppl surviving after 5 years after diagnosis / # ppl diagnosed with cancer). My dataset is quite simple, it has pt_id, clinic_id and survival (0/1). I have decided to ignore my clinic_id since I am interested in the overall rate. How do I use SAS to calculate the standard deviation? PROC FREQ doesn't have anything I can find easily.
Or should I be using a confidence interval instead?
Ultimately I'd like to know if each of my clinics is statistically higher or lower than my overall clinic rate.
Thanks.
Proc Mean or Summary may work for simple analysis. The Mean of a 0/1 coded variable is actually the percentage of 1's.
Proc summary data = have;
class clinic_id;
var survival;
output out= want mean=rate Lclm = LowerCl UCLM=UpperCl;
run;
The _type_ variable will have a value of 0 indicating overall rate or limits for the data and each clinic will have it's result on a separate line.
Or a more human readable:
proc tabulate data=have; class clinic; var survival; table all clinic, survival*(mean='Rate'*f=percent8.2 lclm='Lower CL'**f=percent8.2 uclm='Upper CL'**f=percent8.2); ; run;
The results will be rate of 1 responses.
Proc Mean or Summary may work for simple analysis. The Mean of a 0/1 coded variable is actually the percentage of 1's.
Proc summary data = have;
class clinic_id;
var survival;
output out= want mean=rate Lclm = LowerCl UCLM=UpperCl;
run;
The _type_ variable will have a value of 0 indicating overall rate or limits for the data and each clinic will have it's result on a separate line.
Or a more human readable:
proc tabulate data=have; class clinic; var survival; table all clinic, survival*(mean='Rate'*f=percent8.2 lclm='Lower CL'**f=percent8.2 uclm='Upper CL'**f=percent8.2); ; run;
The results will be rate of 1 responses.
Thanks, ballardw!
The proc summary didn't work for reason reason (I get all 0 values), but the proc tabulate worked great, except that I had to change it so that there was only one astrix instead of two (modified below).
Appreciate you taking the time to help out!
proc tabulate data=have; class clinic; var survival; table all clinic, survival*(mean='Rate'*f=percent8.2 lclm='Lower CL'*f=percent8.2 uclm='Upper CL'*f=percent8.2); ; run;
If you're trying to compare these, a Chi-Square (via PROC FREQ) test would be appropriate to test the overall distribution.
To do the pairwise comparisons, make sure to include a Bonferonni correction for multiple testing but ideally you should calculate an age/sex standardized rate unless you have reason to believe your clinics have the same patient distribution.
If you decide to standardize, check out PROC STRATE
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 25. Read more here about why you should contribute and what is in it for you!
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.