Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: simple programming question relating to lists


From   Johannes Geyer <JGeyer@diw.de>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: simple programming question relating to lists
Date   Wed, 14 Nov 2007 17:20:07 +0100

I think so too that something does not work with your code - I do not know 
why

but the code by Philipp Rehm works:

tab x, gen(yf)
ds yf*
di "`r(varlist)'"
local vars = "`r(varlist)'"
sum `vars'

johannes

----------------------
Johannes Geyer
Deutsches Institut für Wirtschaftsforschung (DIW Berlin)
German Institute for Economic Research 
Department of Public Economics
DIW Berlin
Mohrenstraße 58
10117 Berlin
Tel: +49-30-89789-258



"Richard Boylan" <rtboylan@gmail.com> 
Gesendet von: owner-statalist@hsphsun2.harvard.edu
14/11/2007 17:15
Bitte antworten an
statalist@hsphsun2.harvard.edu


An
statalist@hsphsun2.harvard.edu
Kopie

Thema
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 <n.j.cox@durham.ac.uk> 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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index