Statalist The Stata Listserver


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

Re: st: RE: new local macro from results of loop


From   Maarten buis <maartenbuis@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: new local macro from results of loop
Date   Wed, 30 May 2007 16:37:51 +0100 (BST)

hmmm, having just given this answer I am now looking at a program of
mine that I am trying to debug and I seem to run into a problem where
the solution I have just given does not work. Here is a an excerpt from
my trace:
 
    - if `i' == `trans' {
    = if 2 == 2 {
    - di `eqnsdenom'
    = di 

    - local eqnsdenom `eqnsdenom' `equ'
    = local eqnsdenom  2
    - di `eqnsdenom'                  
    = di                  <-- I would have expected this to read: di 2 


    - local k = `j' - 1
    = local k = 2 - 1
    - if `choice' == `k' {
    = if 1 == 1 {
    - local eqnum = `equ'
    = local eqnum = 2
    - }
    - }
    - local `equ++'
    = local 2
    - }
    - if `i' == `trans' {
    = if 2 == 2 {
    - di `eqnsdenom'
    = di                  <-- I would have expected this to read: di 2 


    - local eqnsdenom `eqnsdenom' `equ'
    = local eqnsdenom  3  <-- I would have expected this to read: 
local eqnsdenom 2  3 
    - di `eqnsdenom'
    = di                 <-- I would have expected this to read: di 2 3



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Maarten Buis
Sent: woensdag 30 mei 2007 17:16
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: new local macro from results of loop

foreach v of local lvstk {
    egen `v'nbeg = sum(liv_begnum) if `v', by(houscode qtr)
    egen `v'nend = sum(liv_endnum) if `v', by(houscode qtr)
    local lvstknos "`lvstknos' `v'nbeg `v'nend"
}

Hope this helps,
Maarten


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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