Statalist


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

st: RE: Re: Display labels


From   philippe van kerm <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Re: Display labels
Date   Tue, 10 Jun 2008 16:51:02 +0200

The macro extended function  `: label (state) `i''  should do the job:

sysuse auto
forval i=0/1 {
 di "`i'"
 di "`: label (foreign) `i''"
}

Philippe

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Janet Hill
Sent: Tuesday, June 10, 2008 4:39 PM
To: [email protected]
Subject: st: Re: Display labels

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/

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