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: Assign fiscal year-end values to a specific event in time
From
miriam geringer <[email protected]>
To
[email protected]
Subject
st: Assign fiscal year-end values to a specific event in time
Date
Sat, 25 Jan 2014 20:19:58 +0100
Dear Statalist,
I have the following two datasets:
1)
Company Date Year Price Event
A 31Okt 1988
A 29Nov 1988 10
A 31Dez 1988
A 31Jan 1989
A 14Feb 1989 EventX
A 28Feb 1989
A 31Mar 1989
B
B
....
Basically, there is some event going on in 1989. This event can happen
in every month, on every day. I want to assign a specific value from
the previous fiscal-year to the event in 1989. To be more precise, I
want to assign the fiscal year-end price from fiscal year 1988 to the
event which happens - in our example - on 14Feb 1989. In the end, I
only need to know in what year the event happened and the
corresponding price from the previous fiscal year-end. Sometimes,
there is no price available in the previous fiscal year, then it
should be just marked as missing value.
---- Fiscal Year-End 1988 ------- Event -------- Fiscal Year-End 1889
>>>>> Assign Fiscal Year-End 1988 to Event
The fiscal year can end in every month and it is possible that, for
example, the fiscal year ends on 31Jan 1989 and the event occurs on
14Feb 1989. Then the 31Jan 1989 value shall be assigned.
It should be something like:
If Stata finds an EventX in fiscal year 1989 of Company A, go to
fiscal year 1988 and take the 1988 fiscal year-end price of Company A
and assign it to the EventX in 1989.
2) The second dataset is identical. However, this time I want to
assign the first available fiscal year-end value.
Company Date Year Price Event
A 31Okt 1988
A 29Nov 1988
A 31Dez 1988
A 31Jan 1989
A 14Feb 1989 EventY
A 28Feb 1989
A 31Mar 1989 10
B
B
....
In this example, let's assume the year ends on 31Mar 1989 and on that
date, the price is 10 (the fiscal year-end price). I want to assign
this price to the row with the EventY and 14Feb. The same as in
dataset 1, just the other way around.
It should be something like:
If Stata finds an EventY in year 1989 of Company A, take the first
available fiscal year-end value (first one available after the event
occured). The event can occur in February and the fiscal year can
could end shortly after. Just take the next available value, no matter
whether there is a calendar year shift in between or not.
Thanks
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/