|
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Saving 1 observation
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: [email protected]
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/