Andreas,
You are correct.
Thanks for Nick Cox for suggesting the answer and Andreas for
insisting that it was correct.
Richard
On Nov 14, 2007 10:36 AM, Andreas Peichl <[email protected]> wrote:
> Richard,
>
> This works on my machine:
>
> set obs 10
> gen y = _n
> tab y, gen(yf)
> local ny = r(r)
> local vars yf1-yf`ny'
> sum `vars'
>
> Maybe your local vars is defined in a do file and then you try to access it
> with sum after the do-file ends?
>
> Cheers,
> Andreas
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Richard Boylan
> Sent: Wednesday, November 14, 2007 5:14 PM
> To: [email protected]
> Subject: Re: st: RE: simple programming question relating to lists
>
> No, this does not work.
>
> If I do this and type, for instance,
>
> sum `vars'
>
> I get the message
>
> "yf. invalid name"
>
> On Nov 14, 2007 10:03 AM, Nick Cox <[email protected]> wrote:
> > One ` character too many.
> >
> > tab y, gen(yf)
> > local ny = r(r)
> > local vars yf1-yf`ny'
> >
> > Richard Boylan
> >
> > I have a simple programming question; I am sure it is answered
> > someplace but I couldn't figure out the right keywords to search for
> > it (I tried for a while!)
> >
> > Here is what I would like to do, but STATA does not let me do that.
> >
> >
> > *create dummy variable for variable yf
> > tab y, gen(yf)
> >
> > * figure out how many dummy variables I have created
> > local ny = r(r)
> >
> > * Here is the step that does not work
> > * I would like to create a list including all the dummy variables I
> > created
> >
> > local vars "yf1-yf``ny' "
> >
> > *
> > * 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/