BookmarkSubscribeRSS Feed
Vivio
Calcite | Level 5

Hi, I am trying to calculate the relative risk of SMM per province and obtain different RR estimates for each province with ON as the reference.

My data looks something like this:

Vivio_0-1692906541267.png

I have tried different methods but none is working. Please help.

Method 1 using binomial does not give me separate RRs. I also saw somewhere about removing the "param" and estimate line but this did not work either, neither does using NLMeans macro.

proc genmod data= smm.uvu descending;
class province1(ref='ON')/ param=ref;
model SMM = province1/d=bin link=log;
estimate 'SMM RR by province' province1 1/exp;
lsmeans province1 / diff exp cl;
title "RR SMM type by province";
run;

 

Method 2. The proc freq method below is only giving me 2*2 freq without any RR:

proc freq data=uvu2 order=data;
tables province1*SMM/relrisk;
run;

 

1 REPLY 1
mkeintz
PROC Star

It looks like proc freq only does relative risk for 2x2 tables.  So you could create a dataset with a sequence of province pairs,  i.e. all the 'AB' and 'ON' observations (pair_num=1), then all the 'BC' and 'ON' observations (pair_num=2).  Then you could do a sequence of 2x2 tables  using PROC FREQ -- BY PAIR_NUM, as here:

 

data ON;
  set have (where=(province='ON'));
run;

data test ;
  set have (where=(province^='ON'));
  by province ;
  retain pairnum 0   pairing 'XX vs YY';
  if first.province then do;
    pairnum+1;
    pairing=catx(' ',province,'vs','ON');
  end;
  output;

  if last.province then do ptr=1 to n_on;
    set ON nobs=n_on point=ptr;
    output;
  end;
run;

proc freq data=test;
  by pairnum pairing;
  tables province*smm / nopercent nocol ;
  exact relrisk (column=2 method=noscore);
run;

I used the "method=noscore" option because it is much faster than the default (method=score).  Take a look at the RELRISK <(options)>  section of the EXACT statement documentation.  If you have a lot of pairings to examine, you might want to test this on just a couple to get an idea of how long it will take to run.

 

And on another note, I don't know how much "confidence" one can have in a set of relrisk confidence limits when each set re-use the same province=ON data.  That's an estimation problem that I never had to face.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

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
  • 1 reply
  • 213 views
  • 0 likes
  • 2 in conversation