Statalist


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

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


From   gjhxmu@sina.com
To   statalist<statalist@hsphsun2.harvard.edu>
Subject   st: Is there a command similar to "bys" if I want to gsort the variables?
Date   Thu, 03 Dec 2009 23:54:45 +0800

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?

Thank you for any help!

Best regards,

Rose
 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index