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 on April 23, and its replacement, 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 <>
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
<> 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
Small print: I use this email account for mailing lists only.
*   For searches and help try:

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