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: Get back to original sample data
From
Steven Samuels <[email protected]>
To
[email protected]
Subject
Re: st: Get back to original sample data
Date
Sun, 5 Jun 2011 10:24:15 -0400
Continuing on Nick's theme:
*******
preserve
drop if substr(string(sich), 1, 1) == "4"
[do stuff]
restore
*******
if the analysis is the same for all subsets, then:
*****************
foreach m of numlist 1 3 4 7 9{
preserve
drop if substr(string(sich), 1, 1) == "`m'"
di "All firms except sich = `m'xxx"
[do stuff]
restore
}
*******************
Steve
On Jun 5, 2011, at 5:20 AM, Nick Cox wrote:
gen is4 = substr(string(sich), 1, 1) == "4"
... if is4
Nick
On Sun, Jun 5, 2011 at 9:32 AM, Achmed Aldai <[email protected]> wrote:
> Hi
>
> I am currently working on a do file where I am eliminating firms of different industries. Here is an extract
>
> gvkey sich
> 1001 1120
> 1001 1120
> 1001 1120
> 1001 1120
> 1001 1120
> 1200 2310
> 1200 2310
> 1200 2310
> 1200 2310
> 3201 4320
> 3201 4320
> 3210 4335
> 3210 4335
>
> If I drop e.g. all firms with a beginning sich of 4: After this analysis I want to have all the firms in my sample again. So how can I come back to the complete sample again to do another analysis.
> I want to have all this in the same do file.
*
* 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/