Bookmark and Share

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]

RE: st: Convert SAS code to STATA


From   Marquis Hawkins <marquishawkins82@hotmail.com>
To   STATA LISTSERV <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Convert SAS code to STATA
Date   Sat, 22 Sep 2012 15:59:25 -0400

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index