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

st: RE: programming questions


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: programming questions
Date   Tue, 5 Jul 2005 21:14:34 +0100

Others picked up the point that it 
would be better as 

if `k' == 1 { 

I'd suggest a further improvement: 

<commands 1> 

forval k = 2/10 { 
	<commands 2> 
}

That way the -if- is rendered unnecessary. 

Nick 
[email protected] 

Dinesh Sharma
 
> Given below is a forval loop I am working on
> 
> forval k=1(1)10{
>        if `k'=1{
>           commands
>        }
>        else{
>           commands
>        }
> }
> 
> The if part of the above program is giving error message. I will 
> appreciate any suggestions.

*
*   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