Statalist


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

st: AW: AW: tsset problem


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: tsset problem
Date   Thu, 21 Jan 2010 19:46:33 +0100

<> 


BTW, was "26/01/2004" really intentional? Does not blend in with all the
other dates in your example :-)



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Donnerstag, 21. Januar 2010 19:44
An: [email protected]
Betreff: st: AW: tsset problem


<> 



*************
clear*

input str15 date    time    price
"26/01/2009"     83000     100.03
"26/01/2009"     91500     100.14
"26/01/2004"     150300    100.1
"28/01/2009"     101500    100.09
"28/01/2009"     112300    100.11
"28/01/2009"     130000    100.09  
end

compress

gen double mydate=date(date, "DMY")
format mydate %tdMonth_DD,_CCYY

bys mydate (time): gen diff=price[_n]-price[_n-1]
li, noobs sepby(date)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Beatrice Crozza
Gesendet: Donnerstag, 21. Januar 2010 19:29
An: [email protected]
Betreff: st: tsset problem

Dear All,

I have have repeated values for my data as in this example:

date               time       price
26/01/2009     83000     100.03
26/01/2009     91500     100.14
26/01/2004     150300    100.1
28/01/2009     101500    100.09
28/01/2009     112300    100.11
28/01/2009     130000    100.09

What I would like to do is to calculate the difference between two
prices for each day. This means that for each day I will have a
missing value because I don't want to consider the difference of
prices between two days.

 I constructed a time variable such as:
generate ttime=_n
but in this way I have also the difference of prices between two days.

I need to solve this problem in order to do further analysis. Could you help
me?

Many thanks,

Bea
*
*   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/


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