Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

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


From   tashi lama <[email protected]>
To   <[email protected]>
Subject   RE: st: ranking variables on the basis of total values of observations
Date   Wed, 28 Mar 2012 19:49:50 +0000

   

        date      var2   var3   var4  
1. 05jan2010        3      1     7  
2. 06jan2010        2      3     6  
3. 07jan2010        4      4     5  
4. 08jan2010        1      2     4  
5. 09jan2010        5      8     3  
6. 10jan2010        8      9     2  
7. 11jan2010        4      6     3  
8. 12jan2010        3      3     8  
9. 13jan2010        1      2     3  

 

 

 

Say, I would like to rank var2  for certain period of time say (05jan2010-09jan2010). So, I would have Stata add the obs values from 05jan2010 to 09jan2010 for all the variables and rank var2 like 1st or 2nd or 3rd. I looked at rowsum. I don't think it will help. 

 

Thanks, 

Nick 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 


> Date: Wed, 28 Mar 2012 20:34:58 +0100
> Subject: Re: st: ranking variables on the basis of total values of observations
> From: [email protected]
> To: [email protected]
> 
> As far as I can see this could mean several things. I am not clear
> that when you say "rank" you don't mean "order" instead.
> 
> I don't think you want -rowranks- (SSC).
> 
> Why not just give us a toy dataset, with say 5 observations and 5
> variables, and what you want to change it to? Then it should be easier
> to see what you want.
> 
> By the way, adding lots of blank lines just makes your posts more
> difficult to read. I've edited what came in.
> 
> Nick
> 
> On Wed, Mar 28, 2012 at 8:22 PM, tashi lama <[email protected]> wrote:
> >
> > 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....
> 
> *
> * 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/ 		 	   		  
*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index