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

st: RE: Creating a dummy variable that 'marks out' useless cases


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: RE: Creating a dummy variable that 'marks out' useless cases
Date   Sun, 12 Dec 2004 21:01:17 -0600

> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Clive Nicholas
> Sent: Sunday, December 12, 2004 8:25 PM
> To: [email protected]
> Subject: st: Creating a dummy variable that 'marks out' useless cases
> 
> All,
> 
> Exclusive to Statalist: the latest instalment of "Clive's Serendipitous
> Adventures With His Unwieldy Dataset".
> 
<snip>
> 
> As you can see, -mark- is 0 when _either_ -conch- or -edconch- is missing
> _or_ when -marker- is 0 (or, indeed, both). I thought this would be a dead
> simple task (perhaps it really is), but all the commands I've issued so
> far aren't executing what I want. For example:
> 
<snip>

Clive,

How about this:

. mark mark2 if ed != .

. replace mark2 = 0 if  co == .
(0 real changes made)

. replace mark2 = 0 if marker == 0
(6 real changes made)

. cl, noobs

    pano      conch    edconch    marker      mark     mark2
     436    2.08482   1.042244         1         1         1
     436   2.551552   23.68557         0         0         0
     436   1.171085   18.44246         0         0         0
     436   2.551552   28.24039         0         0         0
     436   1.171085   23.11701         0         0         0
     436   9.708897    6.17593         0         0         0
     436   9.708897   9.517298         0         0         0
     437   2.786781          .         1         0         0
     437   .6094589          .         1         0         0
     437   12.96428          .         1         0         0
     437   1.095558          .         1         0         0
     438   7.136993   21.97673         1         1         1
     438   .5475883   5.041264         1         1         1
     438   2.488335   .6113586         1         1         1
     438   6.498318    11.1867         1         1         1
     438   .7604446   21.50825         1         1         1
     439   6.331062   1.482658         1         1         1
     439   1.661823   11.79961         1         1         1
     439   2.188976   3.028099         1         1         1
     439   6.502392   17.35701         1         1         1
     439   3.512476   8.189182         1         1         1


Scott



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