thank you, Richard and Michael. I am using Stata 8 and it's up to date. The code you provided worked nicely, Richard, and I'll use it in my program. I still haven't figured out why the -cond()- isn't working. I have to read Gould's link that Michael provide.
Thanks again.
Paul
-----Original Message-----
From: [email protected] on behalf of Richard Williams
Sent: Thu 1/1/2004 10:24 AM
To: [email protected]
Cc:
Subject: Re: repost: -cond()- function
At 08:59 AM 1/1/2004 -0500, VISINTAINER PAUL wrote:
>I have an integer variable that I would like to collapse into a
>dichotomous variable. Using the following statement:
>
> .gen cholcat = cond(chol,0,1,9)
>
>produces the same output as:
>
> .gen cholcat = cond(chol,0,1)
>
>The first statement continues to recode "missings" as 1, not 9. In order
>to capture the missings appropriately, I have to follow each -cond()-
>statement with a -replace- command.
>
>Am I using the -cond()- function appropriately?
Well, if it is any consolation, it looks to me like you are doing it
exactly right. In fact, I just tried it with some data I made up using
your exact syntax, and gen cholcat = cond(chol,0,1,9) worked fine.
I am using Stata 8; what version do you have? If not 8, maybe the syntax
has changed across time?
Incidentally, this command produces a var coded 0, 1, and missing, if that
helps any:
gen cholcat = cond(chol,0,1) if chol <.
-------------------------------------------
Richard Williams, Associate Professor
OFFICE: (574)631-6668, (574)631-6463
FAX: (574)288-4373
HOME: (574)289-5227
EMAIL: [email protected]
WWW (personal): http://www.nd.edu/~rwilliam
WWW (department): http://www.nd.edu/~soc
*
* 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/
<<winmail.dat>>