Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[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 <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
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
<danielepacifico@yahoo.it> 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/


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