Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: count cases of a string variable,


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: count cases of a string variable,
Date   Thu, 1 May 2008 12:09:30 +0100 (BST)

Because there is a typo in "65", or at least it does not conform
exactly to the value in the variable age42. If you type -levelsof
age42- you will get the exact values, and than you can use those.

-- Maarten

--- Tunga Kantarci <[email protected]> wrote:

> Thanks for the reply. I was trying to do the second one, which you
> mentioned my command is legal. But it does not work. Why?:
> 
> 
>  tab age42
> 
>                                  age q4 |      Freq.     Percent     
>   Cum.
>
----------------------------------------+-----------------------------------
> 61                                      |        588       32.04     
>  32.04
> 63                                      |        640       34.88     
>  66.92
> 65                                      |        607       33.08     
> 100.00
>
----------------------------------------+-----------------------------------
>                                   Total |      1,835      100.00
> 
> 
>  describe age42
> 
>               storage  display     value
> variable name   type   format      label      variable label
>
----------------------------------------------------------------------------
>
----------------------------------------------------------------------------
> ---
> age42           str80  %80s                   age q4
> 
> 
> 
>  count if age42 == "65"
>     0
> 
> 
> 
> 
> 
> 
> 
> After I converted the "age42" to "age42num" I get what I want:
> 
> 
>  tab age42num
> 
>                                  age q4 |      Freq.     Percent     
>   Cum.
>
----------------------------------------+-----------------------------------
> 61                                      |        588       32.04     
>  32.04
> 63                                      |        640       34.88     
>  66.92
> 65                                      |        607       33.08     
> 100.00
>
----------------------------------------+-----------------------------------
>                                   Total |      1,835      100.00
> 
> 
>  describe age42num
> 
>               storage  display     value
> variable name   type   format      label      variable label
>
----------------------------------------------------------------------------
>
----------------------------------------------------------------------------
> ---
> age42num        long   %80.0g      ttage42    age q4
> 
> 
>  count if age42num == 3
>   607
> 
> 
> *
> *   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/
> 


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index