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

 From "Martin Weiss" To 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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Pancho Villa
Sent: Montag, 6. Juli 2009 22:32
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: Converting a continuous var into a binary var

On Mon, Jul 6, 2009 at 4:15 PM, Martin Weiss<martin.weiss1@gmx.de> 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/
```