Statalist


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

st: RE: RE: Re: Create dummy


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: Re: Create dummy
Date   Thu, 20 Nov 2008 17:07:09 +0100

Line for the server...





See the benefits of THE MOVING WALL???
http://www.stata-journal.com/sjpdf.html?articlenum=dm0009



HTH
Martin


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Lachenbruch,
Peter
Sent: Thursday, November 20, 2008 5:03 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Re: Create dummy

Also, Ken Higbee had a Stata tip on using value labels in expressions:
You could use
replace quality =1 if b8=="NO":labelname

See the benefits of reading 33 Stata tips???

(I got lucky on that one - until someone points out my errors in the above!)

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Martin Weiss
Sent: Wednesday, November 19, 2008 3:03 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: Re: Create dummy

Well, if it is a -double- then you cannot match it with a string in the -if-

qualifier. I bet it is -label-led, so look for the underlying numeric code 
for "no" via -ta b8, nolabel- and say

replace quality = 1 if b8==0

(if 0 is labelled "no")

HTH
Martin
_______________________
----- Original Message ----- 
From: <mmolina@uniroma3.it>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, November 19, 2008 11:33 PM
Subject: st: Create dummy


> Dear Statlist,
> I need to create a dummy from a double variable (sí, no, no sabe)
> I wrote:
> gen quality = 0
> replace quality = 1 if b8=="no"
>
> And I received the message
>
> type mismatch
> r(109);
>
> What should I do?
>
> Thanks and regards,
> Alejandra Molina
>
>
>
> *
> *   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index