Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: forvalues loop doesn't work?
From
econqian222 <[email protected]>
To
[email protected]
Subject
st: forvalues loop doesn't work?
Date
Mon, 7 May 2012 02:42:32 -0700 (PDT)
Hi, statalist
I have tried to record percentile 90 of quantity for each value of
index, unfortunately, my result still only record the percentile 90 of
quantity for all the values of index, so what's the problem of my program?
My program goes like the following:
forvalues i=1/4760{
if index==`i' {
sum quantity, detail
replace q_cutoff90=r(p90)
}
}
My data goes as this:
index quantity q_cutoff90
1 4 .
1 67 .
2 89 .
2 57 .
2 91 .
3 98 .
3 95 .
3 27 .
. . .
. . .
4760 88 .
4760 56 .
Many thanks
Qian
--
View this message in context: http://statalist.1588530.n2.nabble.com/forvalues-loop-doesn-t-work-tp7534631.html
Sent from the Statalist mailing list archive at Nabble.com.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/