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

st: RE: Equivalent to SAS output statement in STATA


From   "Stephen P Jenkins" <[email protected]>
To   <[email protected]>
Subject   st: RE: Equivalent to SAS output statement in STATA
Date   Thu, 15 Jan 2004 16:54:29 -0000

> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of 
> Dick Campbell
> Sent: 15 January 2004 16:18
> To: statalist-hsphsun2.harvard.edu
> Subject: st: Equivalent to SAS output statement in STATA
> 
> 
> Having used SAS for data management for many years, I have 
> become addicted to the OUTPUT statement which allows me to 
> write multiple output records from an input data file. A 
> standard application is going from wide format to long. Of 
> course, Stata's RESHAPE does that quite nicely, but there are 
> other instances where I still feel the need to use Output. I 
> have looked at various web sites that provide SAS to Stata 
> equivalents, e. g. the Carolina Population Center's very nice 
> tutorial, but can't seem to find a discussion of this 
> particular issue. I suspect that most of the tasks I want to 
> accomplish can be done through some clever application of 
> RESHAPE, but if someone knows of an FAQ, discussion, 
> comparison or whatever regarding this particular issue I 
> would appreciate knowing about it.


Please give us some examples of the "other instances" 
for which you would like this functionality. (I write as one 
not very familiar at all with SAS -- is OUTPUT a PROC or an option
within a PROC? )

One reason for wanting to create multiple records is to convert 
a discrete time survival data set from organisation based on one 
data row per subject to one row per period at which subject at risk 
of the event ("person-period" data). You can use the -expand- command
for this.  It is a form of episode splitting for which the analogous 
command for use with survival time data is -stsplit- (in fact 
-stsplit-ting at each period does the same as -expand-).
[To do this in SAS, I have used a DATA loop, with OUTPUT option within
it,
which seemed rather cumbersome.)


Stephen
-------------------------------------------------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research
University of Essex, Colchester CO4 3SQ, U.K.
Tel: +44 1206 873374.  Fax: +44 1206 873151.
http://www.iser.essex.ac.uk   

*
*   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/



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