Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: forv


From   "Scott Merryman" <[email protected]>
To   <[email protected]>
Subject   st: Re: forv
Date   Tue, 14 Jan 2003 18:01:12 -0600

It should be: uniform()  with no spaces before the parentheses.

Also, you will need to drop the "gen n = _n" because it cause the do file to
choke after the first loop.

Maybe something like this:

local nvar 10
 set obs 25
 gen n = _n
 forvalues i=1/`nvar'{
    gen coef`i' = uniform()
    gen  new`i' = coef`i'  - `nvar'
 }



Scott

----- Original Message -----
From: "Rajiv Mallick" <[email protected]>
To: <[email protected]>
Sent: Tuesday, January 14, 2003 5:43 PM
Subject: st: forv


> I run the following code and get ""uniform not found r(111);"" error
> message.  Am I missing something?
>
> Also, how can I save values of coef`i'-`nvar' in a Stata file?
>
> Thank you
> Rajiv
>
> code:
> -------------------
> local nvar 10
> set obs 25
> forvalues i=1/`nvar'{
> gen coef`i' = uniform ()
> gen n = _n
> }
> clear
>
>
> _________________________________________________________________
> MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*
> http://join.msn.com/?page=features/virus
>
> *
> *   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index