Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: Problems with "if X==number"


From   Sarah Elizabeth Edgington <sedging@ucla.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Problems with "if X==number"
Date   Sun, 25 Jul 2010 00:09:01 -0700

The problem is that gear_ratio is a float variable.
Try:
gen test2=1 if gear_ratio==float(3.58)

-Sarah Edgington

At 11:45 PM 7/24/2010, you wrote:
Using Stata/MP 11.1, Windows Vista.

Why is my Stata suddenly doing this? Is this something to do with some
obscure Stata setting, or do I have a serious problem with my
installation...

*****************************************************

Code:

sysuse auto
gen test=1 if gear_ratio==3.58
tab test

Output:

. gen test=1 if gear_ratio==3.58
(74 missing values generated)

. tab test
no observations

*****************************************************

Mark Marshall





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