[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: AW: how to make the labels in the localname to be independent of each other? |

Date |
Mon, 17 Aug 2009 19:23:13 +0100 |

You don't _need_ to put them in one (big) macro. You could just put them in several. Here is a sketch. use firstdata foreach v in var * { local l_`v' "`: var label `v''" } use seconddata foreach v in var * { label var `v' "`l_`v''" } Nick n.j.cox@durham.ac.uk gjhxmu@sina.com Martin, thank you for your quick reply. I just take a simply example in my previous posting. In fact, I want to store the labels for certain variables in one dta into a localname and then feed them to other variables in the other dta. However, the labels for certain variables have space, which make things troublesome. From: Martin Weiss <martin.weiss1@gmx.de> If you really do want -_all- variables, then your -word count- is a rather roundabout and hazardous way to get the # of variables. Why not just ************* di in red "# of vars in the dataset: " c(k) ************* gjhxmu@sina.com I generate a localname to stand for the var labels of certain variables. However, there are spaces in the labels of certain variables. How to let stata treat each label as a complete unit? For example, clear input x y 1 2 3 9 end l la var x "the first" la var y "the second" foreach i of varlist _all { loc labels "`labels' `: var l `i''" } di "`labels'" the first the second di "`: word count `labels''" 4 In fact my purpose is to generate a localname including two labels, and the word count of it is 2. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: AW: how to make the labels in the localname to be independent of each other?***From:*gjhxmu@sina.com

- Prev by Date:
**Re: st: Aren't distinct factors from factor analysis or PCA orthogonal to each other?** - Next by Date:
**st: coefficients lost when mata code placed in eclass program** - Previous by thread:
**Re: st: AW: how to make the labels in the localname to be independent of each other?** - Next by thread:
**Re: RE: st: AW: how to make the labels in the localname to be independent of each other?** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |