Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: adjust won't take string value in if statement


From   Tim Wade <wadetj@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: adjust won't take string value in if statement
Date   Fri, 1 Apr 2005 15:02:35 -0500

Happy Friday Statalisters:

I just noticed that "adjust" will not take a string variable in the
"if" statement. Is this intentional? I can't imagine why it would be.

. adjust anycontact=1 "`list2'" if  beach=="HB", by(anycontact 
m_l10count_dy) se gen(swim2) pr  nokey  noheader

HB not found
r(111);

. encode beach, gen(beachnum)


. adjust anycontact=1 "`list2'" if beachnum==1, by(anycontact 
m_l10count_dy)  gen(swim3) pr  nokey noh
> eader
(74 missing values generated)

-----------------------------------------------------------------------------------------------------
any       |
contact   |
with      |                                  meanlog10 daily average
water     | 1.016694 1.058044 1.093425 1.352199 1.606892 1.832678
1.943335 2.070882 2.215488 2.233996
----------+------------------------------------------------------------------------------------------
        0 |  .089337  .085384  .094242  .091299  .094656  .087423 
.086623  .092633  .089453  .098083
        1 |  .100255   .10201   .10333  .112783  .117798  .113616 
.117435  .119614  .122636  .123895
-----------------------------------------------------------------------------------------------------

--------------------------------------
any       |
contact   |
with      |  meanlog10 daily average  
water     | 2.639773 2.767887 2.874075
----------+---------------------------
        0 |  .086376  .089791   .09473
        1 |  .131417  .141952  .129688
--------------------------------------

. 
end of do-file
*
*   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/



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