Statalist


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

st: Re: Display labels


From   Janet Hill <[email protected]>
To   [email protected]
Subject   st: Re: Display labels
Date   Tue, 10 Jun 2008 15:39:14 +0100 (BST)

I have a dataset which is classified by a numerical
value which has an associated label:

        state |      Freq.     Percent        Cum.
--------------+-----------------------------------
         Hard |        400       33.33       33.33
Soft. Batch 1 |        400       33.33       66.67
Soft. Batch 2 |        400       33.33      100.00
--------------+-----------------------------------
        Total |      1,200      100.00

.. tab state,nol

      state |      Freq.     Percent        Cum.
------------+-----------------------------------
          1 |        400       33.33       33.33
          2 |        400       33.33       66.67
          3 |        400       33.33      100.00
------------+-----------------------------------
      Total |      1,200      100.00
I loop over this variable with prior knowledge of the
numerical values of state
forvalues i=1(1)3{
di `i'
su a if state==`i'
....other calculations etc.
}
and this displays the numeric value of i. What I would
like to do display the label. I tried setting up a
local macro with the labels for state but this failed.
I would be grateful for some advice on the correct
syntax for this.
Thanks,
Janet



      __________________________________________________________
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