Hello,
I am fairly new to Stata and am trying to write a code to understand the sequence of flights.My code is
set obs 509519
local count = 1
local slno = 1
gen sequence = _n
forval slno = 1(1)509517{
replace `sequence' = `count' in `slno'
while ((flightnum[`slno'] == flightnum[`slno' + 1]) && (tailnum[`slno'] == tailnum[`slno'+1])){
replace `sequence' = `count' in `slno'
replace `count' = `count' + 1
replace `slno' =`slno' + 1
}
}
and gives the error r(100) varlist required. Could anybody help me with this ? Thankyou in advance
I am fairly new to Stata and am trying to write a code to understand the sequence of flights.My code is
set obs 509519
local count = 1
local slno = 1
gen sequence = _n
forval slno = 1(1)509517{
replace `sequence' = `count' in `slno'
while ((flightnum[`slno'] == flightnum[`slno' + 1]) && (tailnum[`slno'] == tailnum[`slno'+1])){
replace `sequence' = `count' in `slno'
replace `count' = `count' + 1
replace `slno' =`slno' + 1
}
}
and gives the error r(100) varlist required. Could anybody help me with this ? Thankyou in advance
Comment