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

Re: st: Re: labelling extended missing values


From   Joseph Coveney <[email protected]>
To   Statalist <[email protected]>
Subject   Re: st: Re: labelling extended missing values
Date   Thu, 11 Dec 2003 10:22:43 +0900

Although you defined the value labels, it seems as if you haven't assigned the 
labels to the values.  Add the following command in between 
-label define q1 . . .- and -tabulate q1, missing-

label variable q1 q1


When I do the following, I get what you're looking for

set obs 4
generate byte q1 = 1
replace q1 = .a in 2
replace q1 = .b in 3
replace q1 = 2 in 4
label define q1 1 a1 2 a2 .a unsure .b "won't tell"
label values q1 q1            // <- it seems that you're missing this command
tabulate q1, missing

The commands above give me this:

         q1 |      Freq.     Percent        Cum.
------------+-----------------------------------
         a1 |          1       25.00       25.00
         a2 |          1       25.00       50.00
     unsure |          1       25.00       75.00
 won't tell |          1       25.00      100.00
------------+-----------------------------------
      Total |          4      100.00


Joseph Coveney



From: NBER Test wrote:

--------------------------------------------------------------------------------

Thank you for the helpful responses.  I am still
unsure on how to display the labels "unsure" and
"wont tell" for the extended missing values:

. tab q1, missing

 Question 1 |      Freq.     Percent        Cum.
------------+-----------------------------------
         a1 |          1       25.00       25.00
         a2 |          1       25.00       50.00
          . |          2       50.00      100.00
------------+-----------------------------------
      Total |          4      100.00

. list q1

     +----+
     | q1 |
     |----|
  1. | a1 |
  2. |  . |
  3. |  . |
  4. | a2 |
     +----+

Thanks! 

> I am trying to label extended missing values from a
> dataset:
> 1
> .a
> .b
> 2
> with 
> label define q1 1 "a1" 2 "a2" .a "unsure" .b "won't
> tell"
> The data infiles without error.  However,
> . tab q1 if q1 < .
> 
>  Question 1 |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>          a1 |          1       50.00       50.00
>          a2 |          1       50.00      100.00
> ------------+-----------------------------------
>       Total |          2      100.00
> 
> does not display "unsure" and "won't tell".  What
> needs to be done to display these values?



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