Bookmark and Share

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   Daniele Pacifico <[email protected]>
To   [email protected]
Subject   Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)
Date   Thu, 9 Sep 2010 15:28:30 +0000 (GMT)

Thanks, Stan
this is exactly what I have been struggling with! 

Best,
Daniele




----- Original Message ----
From: Stas Kolenikov <[email protected]>
To: [email protected]
Sent: Thu, 9 September, 2010 17:13:02
Subject: Re: st: Problems with:"drawnorm "$varlist"_1, mean(b1) cov(V1)

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/



      


*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index