BookmarkSubscribeRSS Feed
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

 

LaborDay2.png 

 

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=&degrees 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
ChrisHemedinger
Community Manager

Hooray! Wearing my white shoes and matching belt in celebration.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 5914 views
  • 3 likes
  • 2 in conversation