Group option with PROC STDRATE when using indirect method

Solved
Occasional Contributor
Posts: 13

Group option with PROC STDRATE when using indirect method

I would like to reproduce this simple example using PROC STDRATE. I do not see any way to specify a group option when using the indirect standardization method.

Here is my code so far.

```data counts;
input area \$ age \$ death  denom ;
datalines;
Area1 65-69 6 500
Area1 70-74 15 300
Area1 75-79 20 200
Area2 65-69 3 300
Area2 70-74 12 300
Area2 75-79  36 400
;run;

proc sql;
create table aggregate as
select age, sum(death) as death, sum(denom) as denom
from counts group by age;
quit;

/* I need an option to group by area  */
proc stdrate data=counts refdata=aggregate
method=indirect
stat=rate(mult=100)
;
population event=death total=denom;
reference event=death total=denom;
strata Age;
run;```

Accepted Solutions
Solution
‎12-14-2015 04:34 PM
Super User
Posts: 23,754

Re: Group option with PROC STDRATE when using indirect method

If I understand correctly, you're looking for a BY statement.

proc stdrate data=counts refdata=aggregate
method=indirect
stat=rate(mult=100)
;
BY area;
population event=death total=denom;
reference event=death total=denom;
strata Age;
run;

All Replies
Solution
‎12-14-2015 04:34 PM
Super User
Posts: 23,754

Re: Group option with PROC STDRATE when using indirect method

If I understand correctly, you're looking for a BY statement.

proc stdrate data=counts refdata=aggregate
method=indirect
stat=rate(mult=100)
;
BY area;
population event=death total=denom;
reference event=death total=denom;
strata Age;
run;
Occasional Contributor
Posts: 13

Re: Group option with PROC STDRATE when using indirect method

For future reference, in case anyone else has the same issue, the solution below is what I was really after. Its output is a single table with statistics for each area. This is very helpful if you have many areas. I'm gradually learning how to use the ODS!

```ods exclude all;
proc stdrate data=counts refdata=aggregate
method=indirect
stat=rate(mult=100)
plots=smr
;
population event=death total=denom;
reference event=death total=denom;
strata Age;
by area;
ods output smr=Smr_Cs;
run;
ods exclude none;

proc print data=Smr_Cs;
run;```
🔒 This topic is solved and locked.