Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Convert SAS code to STATA
From
Marquis Hawkins <[email protected]>
To
STATA LISTSERV <[email protected]>
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: [email protected]
> To: [email protected]
>
> On Sat, Sep 22, 2012 at 11:59 AM, Marquis Hawkins
> <[email protected]> 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
> [email protected]
>
> "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/