Statalist


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

st: RE: pass quotes in a local macro


From   "Kieran McCaul" <Kieran.McCaul@uwa.edu.au>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: pass quotes in a local macro
Date   Sat, 27 Jun 2009 07:44:04 +0800

...

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: Kieran.McCaul@uwa.edu.au
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: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of moleps islon
Sent: Saturday, 27 June 2009 7:27 AM
To: statalist@hsphsun2.harvard.edu
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/



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