Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)
From 
 
Stas Kolenikov <[email protected]> 
To 
 
[email protected] 
Subject 
 
Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1) 
Date 
 
Thu, 9 Sep 2010 10:13:02 -0500 
On Thu, Sep 9, 2010 at 9:52 AM, Daniele Pacifico
<[email protected]> wrote:
> Dear Statalist,
>
> I have a problem with the following loop:
global varlist "x y z"
forvalues c=1/5{
  local thislist
  tokenize $varlist
  while "`1'" != "" {
    local thislist `thislist' `1'_`c'
    macro shift
  }
  drawnorm `thislist', mean(b`c') cov(V`c')
}
I hope the new variables come out in the right order... if not, you'd
have to be more explicit with something like
   forvalues k=1/`: word count $varlist' {
      local thislist `thislist' `: word `k' of $varlist'
   }
-- 
Stas Kolenikov, also found at http://stas.kolenikov.name
Small print: I use this email account for mailing lists only.
*
*   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/