Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Stata vs SAS Survey Risk Ratios

 From Steve Samuels To statalist@hsphsun2.harvard.edu Subject Re: st: Stata vs SAS Survey Risk Ratios Date Thu, 4 Apr 2013 13:50:52 -0400

```No survey command in Stata uses maximum likelihood, but many solve
pseudo-likelihood equations. -svy: glm- with family(binomial) link(log)
options would give risk ratios directly, but convergence is sometimes
difficult. I would use -svy: logistic- myself:

*************CODE BEGINS*************
sysuse auto, clear
recode rep78 1/2=5
svyset _n
svy: logistic foreign  turn i.rep78

margins rep78, coeflegend post
/* RR 4 vs 3 */
nlcom _b[4.rep78]/_b[3bn.rep78]
/* RR 5 vs 3 */
nlcom _b[5.rep78]/_b[3bn.rep78]

/* Notice Lower limits above <0.
This happens because -nlcom- uses the
delta method, which doesn't know
using knowledge that RR>0 */

capture program drop _all
program antilog
local bound  invnorm(.975)*r(se)
local lparm  r(estimate)
local ll  exp(`lparm'  - `bound')
local ul  exp( `lparm' + `bound')
di  _col(1) "parm = " %8.4g exp(`lparm')  ///
_col(20) "ll ="   %8.4g `ll'  ///
_col(40) "ul ="  %8.4g `ul'
end

svy: logistic foreign  turn i.rep78
margins rep78, expression(log(predict(pr))) post

/* RR 4 vs 3 */
qui lincom _b[4.rep78]-_b[3bn.rep78]
antilog
/* RR 5 vs 3 */
qui lincom _b[5.rep78]-_b[3bn.rep78]
antilog
*****************CODE ENDS  **************

On Apr 4, 2013, at 10:48 AM, Joshua Josephs wrote:

Dear StataListers,
Im  trying to find out exactly what Stata does compared to SAS in calculating risk ratios from survey data. In SAS you calculate a survey logistic regression and then use average predicted margins to get the risk ratios. In Stata you use the svy glm command which uses maximum likelihood. Im trying to find out if Statas method provides the appropriate estimates and confidence intervals.

Any help is appreciated,

Joshua Josephs

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```