Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: AW: use of brace inside of macro


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: use of brace inside of macro
Date   Wed, 16 Jun 2010 09:21:02 +0200

<> 

Seems to work for me:


*************
sysuse auto, clear
macro drop _all

global test  }

forv i=1/2{
	di in r "${test}"
}
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Dr. Bill
Westman
Gesendet: Mittwoch, 16. Juni 2010 04:00
An: statalist@hsphsun2.harvard.edu
Betreff: st: use of brace inside of macro

I am curious whether a brace can be used inside of a macro.

For example: 

sysuse auto, clear
macro drop _all

global test  }
log using test, replace

forvalues j = 1/1  {
macro list _all
}

forvalues x = 1/1  {
macro list _all
${test}
end
break
...
causes Stata to provide r(1) error.

I've tried the macro with and without quotes "" around the brace.

Is this illegal? If not what is the problem?

Thanks.

Bill




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