Statalist


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

st: Re: RE: pass quotes in a local macro


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: RE: pass quotes in a local macro
Date   Sat, 27 Jun 2009 01:49:58 +0200

Yep, even better than omitting the quotes...

HTH
Martin
_______________
----- Original Message ----- From: "Kieran McCaul" <[email protected]>
To: <[email protected]>
Sent: Saturday, June 27, 2009 1:44 AM
Subject: st: RE: pass quotes in a local macro


...

I've deleted all the previous posts regarding this, so I don't know what
you are doing or why, but the following works:


sysuse auto, clear

levelsof for, local(levs)


foreach level of local levs{
loc xt `xt' `level' "`:label(foreign) `level''"
}

di `"`xt'"'



______________________________________________
Kieran McCaul MPH PhD
WA Centre for Health & Ageing (M573)
University of Western Australia
Level 6, Ainslie House
48 Murray St
Perth 6000
Phone: (08) 9224-2701
Fax: (08) 9224 8009
email: [email protected]
http://myprofile.cos.com/mccaul http://www.researcherid.com/rid/B-8751-2008
______________________________________________
If you live to be one hundred, you've got it made.
Very few people die past that age - George Burns

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of moleps islon
Sent: Saturday, 27 June 2009 7:27 AM
To: [email protected]
Subject: st: pass quotes in a local macro

I get an error msg running your code-seems to be missing a double
quote in the beginning of the string-and I still dont get how to pass
the double quotes.

. sysuse auto, clear
(1978 Automobile Data)

. levelsof for, local(levs)
0 1

. foreach level of local levs{
 2. loc xt `xt' `level' /* */  "`:label(foreign) `level''"
 3. }

. di "`xt'"
0 Domestic" 1 "Foreign"" invalid name
r(198);

end of do-file


Regards,
M
*
*   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