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.

Register for SAS Innovate 2025!! The premier event for SAS users, May 6-9 in Orlando FL. Sign up now for the best deals!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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