Upload
lucy-cullifer
View
213
Download
1
Tags:
Embed Size (px)
Citation preview
2012OrlandoFloridaApril 22-25, 2012
Sometimes one needs an optionwith unusual dates
Arthur Tabachneck Matthew KastinThornhill, Ontario Louisville,
ColoradoXia Ke Shan
Beijing, China
art297 FriedEgg
KSharp
Sometimes one needs an optionwith unusual calendar dates
06APR2011
06JUL2011
06OCT2011
06JAN2011
05APR2012
beginning of fiscal year
start of the 4th quarter
start of the 2nd quarter
start of the 3rd quarter
end of fiscal year
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) || | | | | | | | ||_|_|_|_|_|_|_|_| _|_
)) ) | | | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) || | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) ) || | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) ) | )| | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) ) | ) )| | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) ) | ) ) )| | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
)) ) ) ) | ) ) ) )| | | | | | | | ||_|_|_|_|_|_|_|_| _|_
Wouldn’t it be nice to be able to automaticallyemail a correct Chanukah greeting on the right days?
or automatically email Chinese New Year greetings? /^\/^\ _|__| O| \/ /~ \_/ \ \____|__________/ \ \_______ \ `\ \ \ | | \ / / \ / / \\ / / \ \ / / \ \ / / _----_ \ \ / / _-~ ~-_ | | ( ( _-~ _--_ ~-_ _/ | \ ~-____-~ _-~ ~-_ ~-_-~ / ~-_ _-~ ~-_ _-~ ~--______-~ ~-___-~
_\______ /_______ _____\/_|___ / __|_ __/_ / _|_ | | _|__|__ / / __|__ /|\ | | | \/ | / | | /\ \|
the Islamic calendar
the Hebrew calendar
the Chinese agricultural calendar
or any calendar you want?
or conduct analyses of, or based on, dates from:
e.g., to be able to analyze effects thatare functions of annual sporting event schedules?
Step 1: Create interval datasetsdata fyds fqds fmds;
do begin= '06APR1900'd to '05APR2100'd;if day(begin) eq 6 then do;
mbeg=month(begin);season=max(mbeg-3,(mbeg<4)*(mbeg+9));end=intnx('month', begin, 1, 'same')-1; output fmds;if mbeg eq 4 then do;
season=year(begin);end=intnx('year', begin, 1, 'same')-1; output fyds;
end;if mbeg in (4,7,10,1) then do;
season=max(round(mbeg/4,1),(mbeg<4)*4);end=intnx('month', begin, 3, 'same')-1; output fqds;
end;end;
end;format begin end date.;
run;
Step 2: Apply the intervalds System Option
options intervalds=(FiscalQuarter=FQDS FiscalMonth=FMDS FiscalYear=FYDS);
Step 3: Use any desired interval function(s)data want (keep=date fiscal:);
set sashelp.pricedata (obs=12);format date date9.;fiscal_year=intindex( 'FiscalYear', date );fiscal_qtr=intindex( 'FiscalQuarter', date );fiscal_month=intindex( 'FiscalMonth', date );next_year_start=intnx('FiscalYear',date,1,'b');next_year_middle=intnx('FiscalYear',date,1,'m');next_year_end=intnx('FiscalYear',date,1,'e');format date next: date9.;
run;/*Note: You can also use other interval functions*/
which will produce:
fiscal fiscal fiscal_ next_year next_year next_year date _year _qtr month _start _middle _end
01JAN98 1997 3 9 06APR98 05OCT98 05APR9901FEB98 1997 4 10 06APR98 05OCT98 05APR9901MAR98 1997 4 11 06APR98 05OCT98 05APR9901APR98 1997 4 12 06APR98 05OCT98 05APR9901MAY98 1998 1 1 06APR99 05OCT99 05APR0001JUN98 1998 1 2 06APR99 05OCT99 05APR0001JUL98 1998 1 3 06APR99 05OCT99 05APR0001AUG98 1998 2 4 06APR99 05OCT99 05APR0001SEP98 1998 2 5 06APR99 05OCT99 05APR0001OCT98 1998 2 6 06APR99 05OCT99 05APR0001NOV98 1998 3 7 06APR99 05OCT99 05APR0001DEC98 1998 3 8 06APR99 05OCT99 05APR00
British fiscal yearsthe Hebrew calendarthe Islamic calendarthe Chinese Agricultural calendar
the NCAA March Madness tournament
hardest part is creating the interval datasetsour paper includes code that creates datasets for:
the datasets can be transferred to Google Calendar with the code in Bill Roehl’s paper, Using SAS® to Get a Date: Integrating Google Calendar’s API with SAS®
www.sascommunity.org/wiki/Sometimes_One_Needs_an_Option_with_Unusual_Dates
All of the code and this Powerpoint can be found at:
create functions using PROC FCMP
import data from web sites
create and use INTERVALDS datasets
The code includes examples of how to:
automatically create formats from data files
use the hash method to create lookup tables
create and send holiday email greetings
write an expanded/localized Holiday function
Your comments and questions
are valued and encouraged
Arthur Tabachneck, Ph.D. myQNA, Inc., Thornhill, Ontario e-mail: [email protected]
Matthew Kastini-behavior, Inc., Louisville, Coloradoemail: [email protected] Ke ShanChinese Financial Electrical CompanyBeijing, Chinaemail: [email protected]