Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down at the end of May, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"JVerkuilen (Gmail)" <jvverkuilen@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Convert SAS code to STATA |

Date |
Sat, 22 Sep 2012 17:29:20 -0400 |

Before venturing into -margins-, I'd make sure that SAS and Stata are fitting the same model (up to the inevitable differences in say the third or fourth decimal place), even if they're not identified quite the same way. This may not be straightforward as I seem to recall SAS puts out rather different fit statistics than Stata. On Sat, Sep 22, 2012 at 3:59 PM, Marquis Hawkins <marquishawkins82@hotmail.com> wrote: > My goal was to get change per year. with SAS using the contrast "-0.333 0.333 0 0 0 0 ", this compares the average change in GFR over three years between the two groups. I'm not sure how to do this in STATA. > > In SAS I using the following: > > PROC mixed data= habc.habclong covtest; > class habcid ckd1 time; > model gfr = ckd1*time/solution ; > repeated time/type=un subject=habcid; > estimate 'avg change/year between baseline and year 3 for grp 1' ckd1*time -0.333 0.333 0 0 0 0 ; > estimate 'avg change/year between year 3 and year 10 for grp 1' ckd1*time 0 -0.143 0.143 0 0 0 ; > estimate 'avg change/year between baseline and year 3 for grp 2' ckd1*time 0 0 0 -0.333 0.333 0 ; > estimate 'avg change/year between year 3 and year 10 for grp 2' ckd1*time 0 0 0 0 -0.143 0.143 ; > where inclusion=1; > run; > > When I use the following STATA code: > > xi: xtmixed gfr totpa3cat##time if inclusion==1 /// > || habcid: , noconstant residuals(uns, t(time)) nolog reml > > margins totpa3cat time totpa3cat##time if inclusion==1, contrast > > It does not give me the same information. It only gives me the mean GFR at each time point by CKD group. I can't put in the contrast here the same as I do it in SAS. Any advice? > > > > ---------------------------------------- >> Date: Sat, 22 Sep 2012 12:11:52 -0400 >> Subject: Re: st: Convert SAS code to STATA >> From: jvverkuilen@gmail.com >> To: statalist@hsphsun2.harvard.edu >> >> On Sat, Sep 22, 2012 at 11:59 AM, Marquis Hawkins >> <marquishawkins82@hotmail.com> wrote: >> > Hi, >> > >> > Does anyone know how to convert this SAS code to STATA? >> > >> > >> > PROC mixed data= habc.habclong covtest; >> > class habcid ckd1 time; >> > model gfr = ckd1*time/solution ; >> > repeated time/type=un subject=habcid; >> > estimate 'avg change/year between baseline and year 3 for grp 1' ckd1*time -0.333 0.333 0 0 0 0 ; >> > estimate 'avg change/year between year 3 and year 10 for grp 1' ckd1*time 0 -0.143 0.143 0 0 0 ; >> > estimate 'avg change/year between baseline and year 3 for grp 2' ckd1*time 0 0 0 -0.333 0.333 0 ; >> > estimate 'avg change/year between year 3 and year 10 for grp 2' ckd1*time 0 0 0 0 -0.143 0.143 ; >> > where inclusion=1; >> > run; >> >> PROC MIXED would go over to -xtmixed-. >> >> The "estimate" commands would be post-estimation calls to -margins-. >> >> The "class" statement would be done using Stata factor commands (i., >> etc.) or -xi-. >> >> "Repeated" specifies the random structure. That's the part you'll have >> to do a little work to map to the right specification but it looks >> like you wanted an unstructured covariance matrix and that should be >> pretty straightforward to do. >> >> >> -- >> JVVerkuilen, PhD >> jvverkuilen@gmail.com >> >> "Out beyond ideas of wrong-doing and right-doing there is a field. >> I'll meet you there. When the soul lies down in that grass the world >> is too full to talk about." ---Rumi >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/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/statalist/faq > * http://www.ats.ucla.edu/stat/stata/ -- JVVerkuilen, PhD jvverkuilen@gmail.com "Out beyond ideas of wrong-doing and right-doing there is a field. I'll meet you there. When the soul lies down in that grass the world is too full to talk about." ---Rumi * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: Convert SAS code to STATA***From:*Marquis Hawkins <marquishawkins82@hotmail.com>

**Re: st: Convert SAS code to STATA***From:*"JVerkuilen (Gmail)" <jvverkuilen@gmail.com>

**RE: st: Convert SAS code to STATA***From:*Marquis Hawkins <marquishawkins82@hotmail.com>

- Prev by Date:
**RE: st: Quantile regression** - Next by Date:
**st: goodness of fit measure fir ivtobit** - Previous by thread:
**RE: st: Convert SAS code to STATA** - Next by thread:
**Re: st: Convert SAS code to STATA** - Index(es):