Thanks Nick!
I did follow Martin's commands exactly as he wrote them but he did not include the 'by' command so upon double checking the results I noticed that they results did not come out as I wanted. Here is the original code he sent. I simply put a 'bysort year:' before the 'su' and changed the variable names to the appropriate names in my data.
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
***********************************************************
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: Tuesday, January 20, 2009 4:13 PM
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: RE: RE: using saved values
Not following advice!
We need to see your original commands, exactly as typed -- as long
advised in the FAQ -- but in general if you ask -summarize- to repeat
then what you will see will the results of the last -summarize-: r-class
results (and e-class results) are overwritten willy-nilly.
Nick
n.j.cox@durham.ac.uk
Lektzian, David
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
*
* 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/