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: RE: Re: about macro's double quotes


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: about macro's double quotes
Date   Tue, 9 Mar 2010 19:54:30 -0000

You need to 

. set varabbrev off 

for this to work. 

Nick 
n.j.cox@durham.ac.uk 

G. Dai

sorry, I was always reminded that
   r5pnhm already defined
   r(110);
the previous is a typo.

On Tue, Mar 9, 2010 at 11:19 AM, G. Dai <dgecon@gmail.com> wrote:

> I'm a first time  user of macros. As you can see from below, I want to
> generate a  new var r`i'pnhm when x=md.  After execute the do file, it
> runs smoothly for x=md. After that, however, I was always reminded by
STATA
> that
>                r5pnhm5y already defined
>                r(110);
> so what's wrong with the following program. BTW,I'm little bit
confused by
> the macro
> quotes, can anyone say tips?
>
> global set "md mom dad";
> foreach x in $set {;
> forvalues i=5/8{;
> gen r`i'pnhm=. if "`x'"=="md";
> replace r`i'pnhm=int(10*r`i'pnhm5y)/10 if "`x'"=="md";
> ....
> };
>

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