Hi everyone,
I am new to SAS, so there is a fundamental question that I want to ask for help.
I have the list of all company of SEC 10K Filing date as follows:
Filing Date
04/29/1993
11/12/1993
11/29/1993
My condition:
if the date is before 5/30 and it should be the fiscal year 1992, otherwise it is 1993
So the output will be
Filing Date Fiscal Year
04/29/1993 1992
11/12/1993 1993
11/29/1993 1993
Is there any way to get the right fiscal year?
Thanks
Welcome to the SAS Communities 🙂
you can do like this
data have;
input FilingDate :mmddyy10.;
format FilingDate mmddyy10.;
datalines;
04/29/1993
11/12/1993
11/29/1993
;
data want;
set have;
if FilingDate ge mdy(5,30,year(FilingDate)) then FiscalYear=year(FilingDate);
else FiscalYear=year(FilingDate)-1;
run;
Welcome to the SAS Communities 🙂
you can do like this
data have;
input FilingDate :mmddyy10.;
format FilingDate mmddyy10.;
datalines;
04/29/1993
11/12/1993
11/29/1993
;
data want;
set have;
if FilingDate ge mdy(5,30,year(FilingDate)) then FiscalYear=year(FilingDate);
else FiscalYear=year(FilingDate)-1;
run;
Is it always May 30 or can that change in a leapyear?
Then you should take @PeterClemmensen 's solution.
A slight modification uses the ifn() function:
fiscalyear = ifn(filingdate ge mdy(5,30,year(filingdate)),year(filingdate),year(filingdate)-1));
If you are using the filing date from SEC's EDGAR database, then you can't determine with absolute certainty the fiscal year from the filing date of the 10-k. Those are always filed after the fiscal year ends to give companies time to compile the results and prepare the filing. For example, the company I work for filed their 10-k for FY ending 12/31 on 2/6/2019 a little over a month after.
Since the deadline for filing a 10-k with the SEC is generally 60-90 days after the fiscal year ends, a better approach would be...
year(FilingDate - 60)... which is only an approximation but should work in most cases. For example, Google filed their latest 10-k on 2/6/19, so the FY calculation would correctly yield 2018. It also works for retailers like Target and Wal-Mart whose fiscal years end in January. Historically, their 10-k's are usually filed in March, so the calculation would correctly generate a fiscal year in the same year as the filing.
Hi,
I think you are right, and I forget that my date isn't the end of the fiscal date! Could you tell me how I can modify the code base on draycut's? I am not familiar with SAS and afraid that I enter the wrong code ![]()
Is it right?
if FDATE ge mdy(5,30,year(FDATE - 60)) then FiscalYear=year(FDATE - 60);
else FiscalYear=year(FDATE - 60);
Many thanks!!
Another complication: If you look in the section "Notes to Consolidated Financial Statements", there's a paragraph that describes how the financial data is consolidated including a definition of fiscal year. Target describes fiscal year 2018 as ending 2/2/2019 while Wal-mart defines fiscal 2019 as ending 1/31/2019. So while both companies use Feb-Jan fiscal year, each defines the year differently. Good luck.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.