You might get better results with
g narea=-area
bys year (narea): g num=_n
describe, short
2009/12/3 <[email protected]>:
> Dear statalists,
>
> Is there a command similar to "bys" if I want to gsort the variables?
>
> For example,
>
> bys year (area): g num=_n
>
>
> However, I want to gsort the variable of area.
>
>
> I have tried as followings,
>
> gsort year -area
>
> by year: g num=_n
>
>
> Is there an easier way to do it just like -bys-?
>
>
> By the way, when I typed "d,short" after I typed "gsort year -area", the result was as followings,
>
> Contains data from study.dta
> obs: 155
> vars: 6 5 Jun 2009 01:45
> size: 3,875 (99.9% of memory free)
> Sorted by: year
>
> Why the sorted variable did not contain area?
>
*
* 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/