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

st: label value (continued)


From   Jean Bouyer <[email protected]>
To   [email protected]
Subject   st: label value (continued)
Date   Mon, 29 Sep 2003 12:42:00 +0200

Thanks Nick for your answer. I think I can get by with it. However, may I come back to my question in another way, as I think that beyond it, there is something about macros (or about : label) that I don't understand.

I don't understand why this works (where v is a variable with a label value)

local n=6
local ll=v[`n']
display "`: label (v) `ll''"

and this doesn't

local n=6
display "`: label (v) v[`n']'"
(Stata answers invalid syntax)

I have noted also that this doesn't work either
display "`: label (v) v[6]'"
(Stata answers invalid syntax)

Thanks

Jean Bouyer


Jean Bouyer
 >
 >
 > In a .do file, I would like to display the value of some variables
 > for certain subjects (those with an error) using label value rather
 > than initial coding.
 > I succeed with the following code that applies for the the
 > subject #6
 > and the variable is1 (that have the label value outp).
 > Is there a more simple way to do this (I mean with less
 > local macro l and ll) ?
 >
 > Thanks
 >
 > local nn=6
 > local i=1
 > local ll=is`i'[`nn']
 > local l : label outp `ll'
 > display as err "pregnancy outcome " `i' " : " "`l'" "
 > c_ident = " `nn'
 >

Lars Korsholm asked a similar question a few days ago.

If you know a variable name and its value you
can display the value label in one step with

. di "`: label (<varname>) <value>'"

. di "`: label (is1) 6'"

However, your problem doesn't sound like one
where I would do this. Why not just -list-
the selected observations and variables?

Nick
[email protected]
--



------------------------------------------------------------------------------------
Jean BOUYER
INSERM U 569, HOPITAL DE BICETRE, 82 RUE DU GENERAL LECLERC
94276 LE KREMLIN-BICETRE CEDEX - FRANCE
-------------------------------------------------------------------------------------
*
*   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