Hi Michael,
I'm glad that works for you now. RE your question, the "`" (I'm not sure what it's called either! Sorry, a quick google says it's a "grave accent", I just learned something new) tells Stata that what follows is a macro name it, which you have defined. The "'" tells it that it's the end of the name of the macro you are trying to call. So, when the code runs Stata knows that what is written between "`" and "'" is a macro name and it should place in there the contents of the macro, which you have defined earlier in the lines local truea0, local truea1, etc.
If you exclude either the leading "`" or the lagging "'" Stata will most likely complain.
I hope this helps.
Cheers,
Rodrigo
Rodrigo Martell
<http://www.frontier-economics.com>
Frontier Economics Pty. Ltd.
395 Collins Street
Melbourne VIC 3000
Australia
www.frontier-economics.com
switch:
direct:
fax:
mobile:
email:
+61 (0)3 9620 4488
+61 (0)3 9613 1518
+61 (0)3 8614 2711
+61 (0)407 909 811
[email protected] <mailto:[email protected]>
This e-mail, including any attachments, may contain confidential and privileged information for the sole use of the intended recipient(s). Any review, use, disclosure or distribution by others is strictly prohibited. If you are not the intended recipient (or authorised to receive information for the recipient), please contact the sender by reply e-mail and delete all copies of this message. Thank you.
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Michael
McCulloch
Sent: Monday, 26 February 2007 10:38 AM
To: [email protected]
Subject: Re: st: RE: trying local command
Thanks Rodrigo; works just fine!
A minor question, if I might bother you: in the -gen- command line,
what is the function of the character immediately preceding each
local macro name "`"? On my computer, it's on the upper left corner
of the keyboard, on the same key as tithe, "~".
Michael
>
>*set obs 20
>*gen x1 = 2
>*gen x2 = 3
>
>
>local truea0=1
>local truea1=2
>local truea2=3
>
>gen ztreat=`truea0'+`truea1'*x1+`truea2'*x2
>
>I hope this helps.
>
>Cheers,
>
>Rodrigo
>
>Rodrigo Martell
>
> <http://www.frontier-economics.com>
>Frontier Economics Pty. Ltd.
>395 Collins Street
>Melbourne VIC 3000
>Australia
>www.frontier-economics.com
>switch:
>direct:
>fax:
>mobile:
>email:
>
>
>+61 (0)3 9620 4488
>+61 (0)3 9613 1518
>+61 (0)3 8614 2711
>+61 (0)407 909 811
>[email protected]
><mailto:[email protected]>
>
>
>This e-mail, including any attachments, may contain confidential and
>privileged information for the sole use of the intended
>recipient(s). Any review, use, disclosure or distribution by others
>is strictly prohibited. If you are not the intended recipient (or
>authorised to receive information for the recipient), please contact
>the sender by reply e-mail and delete all copies of this message.
>Thank you.
>
>
>
>
>
>-----Original Message-----
>From: [email protected]
>[mailto:[email protected]]On Behalf Of Michael
>McCulloch
>Sent: Monday, 26 February 2007 9:47 AM
>To: [email protected]
>Subject: st: trying local command
>
>
>Hello Statalist members,
>I'm working on learning the use of the -local- command. I'd like to
>define a few variables, then manipulate them. I'm experiencing some
>roadblocks with defining the terms. For example:
>
>. local truea0="1"
>. local truea1="2"
>. gen ztreat='1'+'2'*x1+'3'*x2
>type mismatch
>
>
>
>
>
>--
>
>Michael McCulloch, LAc, MPH
>Research Director
>Pine Street Foundation
>124 Pine St
>San Anselmo, CA 94960-2674
>Tel: (415) 407-1357
>Fax: (415) 485-1065
>[email protected]
>*
>* 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/
>
>*
>* 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/
*
* 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/
*
* 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/