Hi,
how can I do a loop (or an if command) so that STATA goes to the next
value and does required calculations and after that continues to the
next value etc.
The problem is that I tried while loop so that i=i+1. But because my
values are from eg. 1, 5, 6, 7, 11, ... the loop stops because it can't
find number 2.
I tried it like
local i=2
while `i'<687. {
insheet using "C:\Data\Data`i'.txt"
if m==`i' & change !=.{
, where m is the conrol variable and change the valuable the one of
which the calculations are done. This does not work. Instead of saying
"look from m value i" I want that Stata finds the first value of m that
exists in data, and then finds the next existing value etc.
Best regards,
Samu Kurri
This mail has been checked for viruses
*
* 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/