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

From |
gjhxmu@sina.com |

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

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

Date |
Wed, 19 Aug 2009 00:38:20 +0800 |

Nick, thank you very much for your flexible suggestion. I would take it. Best regards, Rose. ----- Original Message ----- 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: 2009-8-18 02:23:13 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/ * * 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/

- Prev by Date:
**Re: Re: Re: st: How to make certain variable names and related coefficients red in the word in the -estout-?** - Next by Date:
**st: AW: MLOGIT versus a set of LOGIT models** - Previous by thread:
**RE: st: AW: how to make the labels in the localname to be independent of each other?** - Next by thread:
**st: coefficients lost when mata code placed in eclass program** - Index(es):

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