Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Saving 1 observation


From   Richard Williams <Richard.A.Williams.5@ND.edu>
To   statalist@hsphsun2.harvard.edu, <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: Saving 1 observation
Date   Wed, 28 May 2008 20:50:07 -0500

At 07:25 PM 5/28/2008, Peter J. Burke wrote:
Sergiy,
        Check out the ado file -savin- (findit savin)

STB-22  dm23  . . . . . . . . . . . .  Saving a subset of the current data
set
        (help savin if installed) . . . . . . . . . . . . . . . . . .  D.
Mabb
        11/94   p.6; STB Reprints Vol 4, pp.31--32
        save subset of the current dataset
Peter
Looks like a handy little command. But while it saves some typing, I bet it doesn't save that much time, because the routine itself uses preserve. Here is the code in its entirety:

*! savin -- save a subset of the current data set (dm23: STB-22)
*! version 1.0 David Mabb October 12, 1994
program define savin
version 3.1
quietly {
local varlist "opt ex"
local if "opt pre"
local in "opt pre"
local using "req nopre"
local options "noLabel REPLACE"
parse "`*'"
preserve
if "`if'`in'"!="" { keep `if' `in' }
keep `varlist'
}
save `using', `replace'
end



-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: Richard.A.Williams.5@ND.Edu
WWW: http://www.nd.edu/~rwilliam

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index