Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: RE: Converting a continuous var into a binary var


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   RE: st: RE: Converting a continuous var into a binary var
Date   Mon, 6 Jul 2009 22:38:57 +0200

<>

Rquires only minor changes...

***
clear*
set obs 10000

gen x=rnormal()
centile x, ce(10)
local p10x=`r(c_1)'

gen z=rnormal()
centile z, ce(10)
local p10z=`r(c_1)'

gen y=cond(x<=`p10x' & z <= `p10z', /*
*/ 0,  cond(x<=`p10x' & z > `p10z', 1, /*
 */ cond(x>`p10x' & z < `p10z',2,3/*
 */ )/* 
 */ )/* 
 */ )

ta y
***


HTH
Martin


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Pancho Villa
Sent: Montag, 6. Juli 2009 22:32
To: [email protected]
Subject: Re: st: RE: Converting a continuous var into a binary var

On Mon, Jul 6, 2009 at 4:15 PM, Martin Weiss<[email protected]> wrote:
>
> <>
>
>
> Am I right that for y=2 the z value does not matter at all? That is what I
> take away from your description of the problem...

Oops, the last line was supposed to be:

y = 3 if x > 10th percentile of x & z > 10th percentile of z
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index