Statalist


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

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


From   [email protected]
To   statalist<[email protected]>
Subject   Re: st: AW: how to make the labels in the localname to be independent of each other?
Date   Tue, 18 Aug 2009 00:35:01 +0800

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.


Look forward to any help.

Thank you very much.


Best regards,

Rose.

----- Original Message -----
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: 2009-8-17 23:19:06


<> 

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黱gliche 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/

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