Statalist


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

Re: st: Is there a command similar to "bys" if I want to gsort the variables?


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Is there a command similar to "bys" if I want to gsort the variables?
Date   Thu, 3 Dec 2009 11:40:07 -0500

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/



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