Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: RE: RE: RE: RE: using saved values


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: RE: RE: RE: RE: using saved values
Date   Tue, 20 Jan 2009 22:33:27 -0000

This is better but why not just give exactly what you typed, as
requested? 

My point remains about -summarize-. When you call it up under -by:- all
that you see with a subsequent -return list- is whatever it did last. 

Earlier in this thread I recommended the use of -egen- for your problem,
but you followed the advice of others instead. I repeat my
recommendation of -egen- which was based mainly on this issue of keeping
multiple results accessibly. 

Nick 
[email protected] 

Lektzian, David

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  
***********************************************************

Nick Cox

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 
[email protected] 

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?

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index