Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: ranking variables on the basis of total values of observations


From   tashi lama <ltashi32@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: ranking variables on the basis of total values of observations
Date   Wed, 28 Mar 2012 19:22:15 +0000

Hello All, 

 

         I have a list of variables and I would like to rank the variables or any given variable for that matter on the basis of total values of their observations. I thought of approaching this problem in the following way. 

   

 

1. find the running sum of all the variables using generate or the total using egen although I think I would prefer generate. 

 

   say there are var1 var2 var3 

 

gen tvar1=sum(var1) 

gen tvar2=sum(var2)

gen tvar3=sum(var3)

 

2. then compare tvar1, tvar2 and tvar3 using if conditions. 

 

 

Once this is done, I would like to expand such that I can rank those variables but for given period of time. And this is essentially why I think generate sum is better for this problem  because it is a running sum. 

 

  say  date var1 var2 var3 

 

I would like to be able to rank variables say for 01jan2011 to 01feb2011 and so on. 

 

 

 

Has anyone worked in this kind of problem before or does anyone have any idea or thought regarding this problem? Any help or lead would be highly appreciated? I saw that there is a stata module rowranks to calculate ranks in a row but i don't know how can it be useful to me. Most probably not.... 

 

Thanks,

Tashi

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