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]

st: Counting Days to recover to or cross the basedate price


From   Muhammad Anees <[email protected]>
To   [email protected]
Subject   st: Counting Days to recover to or cross the basedate price
Date   Wed, 3 Aug 2011 10:45:26 +0500

Hi

I would like to count the number of days it takes for a daily stock
price to recover to or cross the previously defined daily stock price.
I have the sample data for the last ten years like the following.

id	dailydate	        pricesopen	priceshigh
1	03/01/2005	144.15	145.5
2	04/01/2005	142.4	143.1
3	05/01/2005	143	        145.2
4	06/01/2005	143.5	146
5	07/01/2005	145.1	146.2
6	10/01/2005	142	        142.8
7	11/01/2005	143.5	144
8	12/01/2005	143.7	144.2
9	13/01/2005	139.45	140.45
10	14/01/2005	130.5	142.4

I would be pleased to have it like

id	dailydate	        pricesopen	priceshigh	       daysopen	        dayshigh
1	03/01/2005	144.15	145.5	                        basedate1	 basedate2
2	04/01/2005	142.4	143.1		
3	05/01/2005	143	        145.2		
4	06/01/2005	143.5	146		
      3days
5	07/01/2005	145.1	146.2	                             4days	
6	10/01/2005	142	        142.8		
7	11/01/2005	143.5	144		
8	12/01/2005	143.7	144.2		
9	13/01/2005	139.45	140.45		
10	14/01/2005	130.5	142.4		



-- 


Regards

Anees
*
*   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