Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: RE: st: SAS Stata equivalent command


From   Dan Blanchette <[email protected]>
To   [email protected]
Subject   RE: RE: st: SAS Stata equivalent command
Date   Thu, 8 Dec 2005 13:00:54 -0500 (EST)

Please check out "A SAS User's Guide to Stata" www.cpc.unc.edu/services/computer/presentations/sas_to_stata
where you can find some SAS code matched to the equivalent Stata code.

In your circumstance, you have fallen into some obscure SAS coding.
The code: *************************************************************************
if _n_ eq 1 then do;
est = 0; output; est = 0; output; est = 0; output;
end;
*************************************************************************

creates a variable called "est" and sets it to 0 and then creates 3 observations
in the dataset. Why this is important is beyond me, but perhaps it is.
Next the code brings in an existing data set "bi_meta" and concatenates that
onto these 3 observations. Then it sets the variable "est" to be the same value
as the variable "var_logit." And finally it only keeps this new variable "est."

So the eqivalent Stata code would be:

*************************************************************************

clear
set obs 3
gen est = 0
append using "bi_meta.dta"
replace est = var_logit
keep est

*************************************************************************

I hope this helps,

Dan Blanchette

ITS Research Computing Group
University of North Carolina Chapel Hill
[email protected]





----------------------------------------------------------------------------------------------------
Stata The Stata listserver [Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
RE: RE: st: SAS Stata equivalent command
From n j cox <[email protected]>
To [email protected]
Subject RE: RE: st: SAS Stata equivalent command
Date Tue, 06 Dec 2005 12:38:29 +0000
If I understand this correctly, you are trying to

(1) translate SAS to Stata, but are not fluent in both.

(2) use Stata 8 in an area where Stata 9 is much,
much more powerful.

I do not agree or disagree with this. It is possible to
translate programs from languages you have never even
used into Stata, but even in that case it hinges on
how far the code in the other language is transparent
and on how fluent you are in Stata. The transparency
seems to be lacking here.

Short of upgrading to Stata 9, finding out the
statistics of what you want to emulate and trying
to do it in -gllamm- might be your best bet.

Nick
[email protected]

From: "b. water" <[email protected]>

thank you nick (cox) for your response. it is much appreciated. perhaps it
would have helped if i have instead mentioned what i wished to do in its
entirety. however part of my liking for stata/statistics is to learn on the
job kind of thing and to seek help when things could not move further
forward no more in my view (obviously others may disagree with this course
of action or the timing of when to seek advice/help).

i am trying to translate SAS procedure to stata but am currently stuck at a
juncture prior to the PROC Mixed. the SAS codes can be found on Reitsma JB
et. al. Bivariate analysis of sensitivity and specificity produces
informative summary measures in diagnostic reviews. J Clin Epidemiol
2005;58:982-990.

the bits i am stuck at (at the moment in any case):

====================================

/*
In the next step we create a special dataset that contains the 44 calculated
variances of logit sensitivity and the 44 variances of specificity in each
study. Three additional records are created which contain the starting
values for the 3 additional variance parameters of the bivariate model:
record 1 holds the starting value for the between-study variance in logit
sensitivity, record 2 the covariance between logit sensitivity and
specificity, and record 3 the between-study variance in logit specificity
*/

data cov;
/* start the file with three starting values for (co)variance parameters of
the random effects (zero works well) SAS expects the name est for this
variable */
if _n_ eq 1 then do;
est = 0; output; est = 0; output; est = 0; output;
end;

/* followed by the 88 calculated variances of sensitivity and specificity of
each study */
set bi_meta;
est = var_logit; output;
keep est;
run;

====================================

if someone would be able to tell me what these SAS codes trying to achieve i
might be able to do something with stata 8.2 (os wxp pro sp2). i was hoping
that by knowing the equivalence of stata PROC Mixed, the data set-up and
output, working backward, i might be able to slowly pieced it in stata.

searching stata FAQ's and UCLA fantastic stata repository did not
unfortunately help with this particular problem. however, googling did point
to previous postings in 2002/2004 by (among others - apologies in case i
missed some postings) Joseph Coveney, Ben Dwamena and, Gerben ter Riet
concerning bivariate approach. however it bears no resemblance to the SAS
codes in the published article nor (to me) can be adopted/adapted to the
problem at hand. a look at stata cross-sectional time-series reference
manual [XT] for stata 8 did not show an entry on xtmixed but fortunately it
is available on-line on stata help page. i could not see though how this can
be adapted to PROC Mixed as used in the article but this could well reflect
my lack of statistical knowledge and understanding in this area. i am also
handicapped by not having previous SAS exposure at all. in light of ATS UCLA
Mitchell's document where he suggested the complementary nature of
SAS/Stata, learning SAS as another tool for my statistical carpentry could
well creep into my new year resolution. for now, i am hoping that on this
occasion there will at least be someone in the stata lists who is familiar
with SAS/Stata and able to advice/help me.

on that note, thank you again for any forthcoming advice/help. please accept
my apology for the somewhat verbose extent of this posting.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

* Follow-Ups:
o st: Panel data: how to deal with varbles existing in 98 but not in 99
+ From: "Nirina M." <[email protected]>

* Prev by Date: Re: st: histogram x-axis
* Next by Date: Re: st: histogram x-axis
* Previous by thread: st: Re: XML output
* Next by thread: st: Panel data: how to deal with varbles existing in 98 but not in 99
* Index(es):
o Date
o Thread

Contact StataCorp

Home | Site Index | Info | Bookstore | Order Stata | Support | FAQs | News | Search

Contact [email protected] with comments or suggestions about this web site.

� Copyright 2005 StataCorp LP. Terms of Use. Privacy Notice.



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index