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: Find the fiscal year for each obs
From 
 
"Yu Chen, PhD" <[email protected]> 
To 
 
[email protected] 
Subject 
 
st: Find the fiscal year for each obs 
Date 
 
Sat, 6 Apr 2013 06:15:54 -0500 
Dear Statalist,
I have two files. File A contains the daily stock price for each firm,
and file B contains the beginning and ending dates for a fiscal year
for each firm. See below for an illustration (data are hypothetical):
File A:
Firm   Date                Price
IBM    2009/01/15       xxxx
IBM    2009/01/16       xxxx
...................
3M     2010/07/01       yyyy
3M     2010/07/02       yyyy
...................
File B:
Firm   Fiscal Year      Beg. Date    End. Date
IBM    2009               2009/03/01   2010/02/28
IBM    2010               2010/03/01   2011/02/28
..................
3M     2010               2010/06/01    2011/05/31
3M     2011               2011/06/01     2012/05/31
..................
Now, I want indicate in File A for each observation the fiscal year
the observation belongs to, according to the definition in File B.
Conceptually it seems easy: Just compare the date of the observation
in File A with the beginning and ending dates in File B. However, I
find it difficult to write code. Can you help me?
Thank you very much,
Yu Chen
*
*   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/