You can do this, as experiment will show.
Given
global dem "age sex"
global dem1 "age"
you can set
global reg1 "reg hours $dem"
in which case -reg1- will contain
"reg hours age sex"
or you can set
global reg1 "reg hours $dem1"
in which case -reg1- will contain
"reg hours age"
Trailing spaces can also be added as desired.
Whichever definition is last in a session will
overwrite any previous ones.
Nick
[email protected]
Jean Eid
> One more question regarding manipulating global macros. Is there a way
> to do the following
> global reg1 "reg hours $dem ";
> where $dem is defined as
>
> global dem "age sex";
>
> and
>
> global dem1 "age";
>
> now I want to replace $dem with $dem1 in $reg1
>
> All the solutions below do not work since stata attempts to
> execute the
> global macro $dem when calling global macro $reg1.
>
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/