- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 09-03-2018 03:45 AM
(7132 views)
Fretting over what to wear when you go back to work on Tuesday? The Emily Post Institute has advice on Wearing White After Labor Day. Happy Labor Day!
(Update: Added PERCENT keyword to PIECHART statement)
* Fun With SAS ODS Graphics: Can You Wear White After Labor Day?
Reference: Wearing White After Labor Day, emilypost.com/advice/wearing-white-after-labor-day;
proc format; * Special formats;
picture mmmdd other='%b%0d' (datatype=date); * Dates=mmmdd;
picture ddd other='000 Days'; * Days=nnn Days;
data When2WearWhite(keep=DateRange Days); * Create data to chart;
LaborDay=holiday('LABOR',year(today())); * When is Labor Day this year?;
MemorialDay=holiday('MEMORIAL',year(today())); * When is Memorial Day this year?;
length DateRange $ 30.; * Date range label for chart;
DateRange=put(MemorialDay,mmmdd.)||'-'||put(LaborDay,mmmdd.);
DaysInYear=intck('days', /* How many days in this year? */
intnx('years',today(),-1,'e'),intnx('years',today(),0,'e'));
call symput('degrees', /* Compute degrees relative to piechart origin for start of Memorial-Labor Day pie slice */
put(360-(substr(put(MemorialDay,julian5.),3,3)/DaysInYear*360-90),3.));
Days=LaborDay-MemorialDay+1; * Days between Memorial Day & Labor Day (Definitely OK to wear white!);
output;
Days=DaysInYear-Days; * Rest of year (Maybe OK to wear white?);
DateRange='Jan01-'||put(MemorialDay-1,mmmdd.)||','||put(LaborDay+1,mmmdd.)||'-Dec31 ?';
output;
ods graphics on / reset width=8in height=5in; * Create a pie chart with two slices (Memorial-Labor Day, rest of year);
proc template;
define statgraph laborday;
begingraph / datacolors=(white lightgray); * Memorial Day to Labor Day=White (OK), rest of year=LighGray (OK??);
entrytitle 'CAN YOU WEAR WHITE AFTER LABOR DAY?';
layout region; /* Pie wedges proportional to number of days in date range */
piechart category=DateRange response=Days / /* Position Memorial-Labor Day wedge as if year is a clock w/Jan. 1 at 12:00 */
start=°rees categorydirection=clockwise dataskin=crisp
datalabelcontent=(category response percent) datalabelattrs=(color=black) datalabellocation=callout;
endlayout;
endgraph;
end;
run;
proc sgrender data=When2WearWhite template=laborday;
format Days ddd.;
run;
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hooray! Wearing my white shoes and matching belt in celebration.
Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!