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

st: RE: label value


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: label value
Date   Fri, 26 Sep 2003 11:44:46 +0100

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
n.j.cox@durham.ac.uk

*
*   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–2022 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index