Statalist


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

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


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: how to make the labels in the localname to be independent of each other?
Date   Mon, 17 Aug 2009 17:19:06 +0200

<> 

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



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von [email protected]
Gesendet: Montag, 17. August 2009 17:16
An: statalist
Betreff: st: how to make the labels in the localname to be independent of
each other?

Dear statalists,

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.

Could anyone help me ? Thank you.

Best regards,
Rose.
 

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



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