Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: looping over observations

From   "emre ekinci" <>
Subject   st: looping over observations
Date   Wed, 14 Mar 2007 13:23:05 +0000

I have 100 observations.

I want to execute some commands for each is the basic structure:

local i=0

while `i'<=100 {
local ++i

if ((husbage1>husbage2) | (husbage11 <husbage2)) {

stata commands

else {
stata commands


if the logical statment is true for the first observation, it executes all commands within the if statement for other observations as well, although the logical statement is false for some observations.
what is my mistake here? How can I write a loop that executes some bunch of commands (including if else statement)?

thank you.

En etkili ve güvenilir PC Korumayi tercih edin, rahat edin!

* For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index