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

st: 'if' with labels but finds no observations


From   "Paul O'Brien" <paul.obrien@afe2.org.uk>
To   statalist@hsphsun2.harvard.edu
Subject   st: 'if' with labels but finds no observations
Date   Fri, 23 Apr 2004 18:52:54 +0100

Dear All,

I am not sure what the problem is here, but 'if' is not working for some date labels.
year_f is OK up to 2000/1 but beyond that give no observations.


.egen year_f = ncyear(date_v), m(4)


. table year_f
----------------------
  year_f |     Freq.
----------+-----------
 1997/98 |    44,023
 1998/99 |    42,654
  1999/0 |    42,944
  2000/1 |    42,127
  2001/2 |    41,520
  2002/3 |    41,463
  2003/4 |    40,057
----------------------


. table ageint if year_f==2000/1

----------------------
  ageint |     Freq.
----------+-----------
      12 |         5
      13 |        36
      14 |       131
      15 |       346
etc


. table ageint if year_f==2001/2

no observations

r(2000);

But there are observations for year_f==2001/2

 . table ageint year_f

------------------------------------------------------------------------ -
| year_f
ageint | 1997/98 1998/99 1999/0 2000/1 2001/2 2002/3 2003/4
---------- +--------------------------------------------------------------
10 | 1 1 2 1 1
11 | 2 2 2 1 2 1
12 | 2 3 2 5 4 3 7
13 | 13 20 17 36 22 20 12
14 | 73 49 64 131 110 101 99
15 | 238 259 238 346 362 302 325

If I try -list- I get the same thing:

. list if year_f==2000/1

 Observation 129622

   clin_s~e          RC   clin_w~k                  connum           2        date   15-Feb-01        dob   04-Apr-63

etc

 
Observation 129623

   clin_s~e          RC   clin_w~k       D- CON     connum           1       date   07-Feb-01        dob   06-Apr -77

etc

 

. list if year_f==2001/2

This last command gives nothing.

Help gratefully received.

Paul

Dr Paul O'Brien
Westside Contraceptive Services
Raymede Clinic, Exmoor St, London
W10 6DZ
020 8962 4450 - tel
020 8962 4451 - fax
07900 495 118 - mob

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