Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Cohen, Elan" <cohened@upmc.edu> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: r(varlist) |

Date |
Thu, 8 Nov 2012 21:28:16 +0000 |

I think what Tashi is questioning is the fact that typically a local needs to be surrounded by `' in order to be evaluated. But the macro -r(varlist)- does not. - Elan -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Steve Nakoneshny Sent: Thursday, November 08, 2012 16:20 To: statalist@hsphsun2.harvard.edu Subject: Re: st: r(varlist) Tongue in cheek comments aside, you would also need to enclose the called macro as -di `a'- in order to have Stata evaluate the macro. If what you wanted to do was display the contents of the macro (rather than evaluate the macro) you would have to nest it in double quotes -di "`a'"- much as Maarten explained earlier. Steve On 2012-11-08, at 2:12 PM, Steve Nakoneshny wrote: > Keystroke error? > You defined your local as x, not a. > > Steve > > On 2012-11-08, at 2:07 PM, tashi lama wrote: > >> Ok.That explains we need to wrap `r(varlist)' with " " to display the strings. However, >> sysuse auto >> ds >> di r(varlist) shouldn't have given make price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign >> for eg. >> local x "Make" // x is a macro >> di a >> a not found >> >> di a doesn't work but di r(varlist) works although both a and r(varlist) are macros. Please explain. >> >> Thanks, >> Tashi >> >> >>>> >> ---------------------------------------- >>> Date: Thu, 8 Nov 2012 17:33:17 +0100 >>> Subject: Re: st: r(varlist) >>> From: maartenlbuis@gmail.com >>> To: statalist@hsphsun2.harvard.edu >>> >>> You'll get the same again if you type: di "`r(varlist)'". >>> >>> The logic behind what you saw is that >>> >>> di `r(varlist)' >>> >>> is like typing >>> >>> di make price mpg rep78 headroom trunk weight length turn displacement >>> gear_ratio foreign >>> >>> Which means "display the content of the first observation of each of >>> these variables". >>> >>> Hope this helps, >>> Maarten >>> >>> On Thu, Nov 8, 2012 at 5:26 PM, tashi lama <ltashi32@hotmail.com> wrote: >>>> Hello all, >>>> sysuse auto, clear >>>> ds >>>> return list >>>> >>>> macros: >>>> r(varlist) : "make price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign" >>>> >>>> di r(varlist) >>>> make price mpg rep78 headroom trunk weight length turn displacement gear_ratio foreign >>>> >>>> Since r(varlist) is a macro, do I not say >>>> di `r(varlist)' >>>> Surprisingly, when I say di `r(varlisr)' gives me AMC Concord40992232.5112930186401213.57999990 >>>> >>>> >>>> Am I missing something here?? >>>> >>>> Thanks, >>>> Tashi >>>> * >>>> * For searches and help try: >>>> * http://www.stata.com/help.cgi?search >>>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>>> * http://www.ats.ucla.edu/stat/stata/ >>> >>> >>> >>> -- >>> --------------------------------- >>> Maarten L. Buis >>> WZB >>> Reichpietschufer 50 >>> 10785 Berlin >>> Germany >>> >>> http://www.maartenbuis.nl >>> --------------------------------- >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: r(varlist)***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: r(varlist)***From:*tashi lama <ltashi32@hotmail.com>

**Re: st: r(varlist)***From:*Maarten Buis <maartenlbuis@gmail.com>

**RE: st: r(varlist)***From:*tashi lama <ltashi32@hotmail.com>

**Re: st: r(varlist)***From:*Steve Nakoneshny <scnakone@ucalgary.ca>

**Re: st: r(varlist)***From:*Steve Nakoneshny <scnakone@ucalgary.ca>

- Prev by Date:
**Re: st: r(varlist)** - Next by Date:
**st: exporting margins to excel after probit** - Previous by thread:
**Re: st: r(varlist)** - Next by thread:
**Re: st: r(varlist)** - Index(es):