Dear Martin & List,
Originally I ran this in a do file and thought I was getting the results I wanted, but I think this produces summary statistics for the entire dataset not "by year."  For the land variable that I suggested in my original email it is not that important because the 75th and 25th percentile do not change much from year to year, but for other variables I am using, I need to be able to generate the dummies by year.  The problem is that when I use by year before the summarize command it does not seem to be capturing the percentiles to use later.
After I summarize by year this is all I get when I type return list:
return list
scalars:
                  r(N) =  0
              r(sum_w) =  0
                r(sum) =  0
When I just summarize, but not by year, I get:
return list
scalars:
                  r(N) =  6972
              r(sum_w) =  6972
               r(mean) =  685537.7666594951
                r(Var) =  3463911718862.249
                 r(sd) =  1861158.703298096
           r(skewness) =  5.396472941659592
           r(kurtosis) =  36.57465730018304
                r(sum) =  4779569309.15
                r(min) =  1.95
                r(max) =  16389950
                 r(p1) =  60
                 r(p5) =  430
                r(p10) =  720
                r(p25) =  25680
                r(p50) =  121400
                r(p75) =  527970
                r(p90) =  1280000
                r(p95) =  2381740
                r(p99) =  9327420
.
Any thoughts on what I'm doing wrong?
Dave
***********
sysuse auto, clear
su pr,d
loc pc75=r(p75)
loc pc25=r(p25)
g biggerthanp75=pr>`pc75'
g smallerthan25=pr<`pc25'
g inbetween=( biggerthanp75==0 &  smallerthan25==0)
sort pr
l price biggerthanp75 smallerthan25 inbetween
***********
HTH
Martin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Lektzian, David
Sent: Tuesday, January 20, 2009 6:29 PM
To: [email protected]
Subject: st: using saved values
Dear Statalist,
I know this is a pretty simple question, but I was wondering if somebody
could tell my how to get the 75th percentile of a variable and then use it
for a future calculation.  So, specifically, using a cross-sectional time
series data set organized by country and year, I want to do the following:
By year, generate a variable with the 75th percentile value for
SqMilesOfLand
Then generate another variable =1 if the current value for a country of
SqMilesOfLand > 75th percentile.
Then I want to do the same thing for less than the 25th percentile, and
another dummy for being between the 25th and 75th percentiles.
A more general question is that I can't figure out how to call out saved
values from something like summarize and use them in future calculations.
Any help/instruction would be greatly appreciated.
Dave
*
*   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/
*
*   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/
*
*   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/