Bookmark and Share

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   Richard Williams <[email protected]>
To   [email protected], [email protected]
Subject   Re: st: Get back to original sample data
Date   Sun, 05 Jun 2011 11:02:13 -0500

In addition to what everyone else has said, you could always just re-open the original data set.

At 09:24 AM 6/5/2011, Steven Samuels wrote:

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/

-------------------------------------------
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/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index