Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: generating new sorted ID variable


From   "Pagan, jose" <[email protected]>
To   <[email protected]>
Subject   st: generating new sorted ID variable
Date   Tue, 2 Dec 2003 13:40:29 -0500

Dear All, 

I have a variable called ID that goes from 1 through 60, and an X
variable that takes the same value within each ID value (I have an
unbalanced panel of about 50,000 obs). I want to create a new ID
variable that is sorted in ascending or descending order by X so that I
can do a sorted twoway bar graph. Or, better yet, is there a way to sort
twoway bar or rspike graphs? Sorted graphs seem to be an option for
'graph bar' but not for 'twoway bar'. Thanks for your help, Jose.  

For example: 

ID	X	SortedID or SortedID
1	4	2			2
1	4	2			2
1	4	2			2
2	7	1			3
3	2	3			1
3	2	3			1



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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