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

Working9to17.png

 

Working 9 to 17 is the new working 9 to 5. Happy Labor Day!

 

* Fun With SAS ODS Graphics: Working 9 to 17 (Labor Day 2023);

data clock;                                        * Generate points for chart;
pi=constant('pi');                                    
do hour=0 to 23;                                   * Generate points for 24 hours;
  Xhr=sin(hour/24*2*pi);                           * X, Y for hour numbers;
  Yhr=cos(hour/24*2*pi);
  Xm=.9*Xhr;                                       * X, Y for hour markers (circles);                                      
  Ym=.9*Yhr;
  txt=compress(put(hour,2.));                      * Convert hour to text;
  angle=360-hour/24*360;                           * Compute angle to display hour on perpindicular;                
  output;
end;
txt2="HAPPY*LABOR DAY!"; x2=0; y2=0; output;       * Put Happy Labor Day message in center of circle;
Xhr=.; xm=.; x2=.;                                 * Generate a polygon to shade hours between 9 to 17 ("9 to 5" job!);
id=1; x9to17=0; y9to17=0; output;                  * Start polygon at center (0,0);
do hour=9 to 17 by .1;                             * Add points on circle from hours 9 to 17;
  x9to17=1.15*sin(hour/24*2*pi);            
  y9to17=1.15*cos(hour/24*2*pi);
  output;
end; 
                                                   * Generate the "Working 9 to 17" chart; 
ods graphics on / reset antialias height=6in width=6in;
proc sgplot data=clock aspect=1 noautolegend noborder subpixel; 
polygon x=x9to17 y=y9to17 id=id / fill fillattrs=(color=lightgrey) lineattrs=(color=lightgrey); * Shade hours between 9 and 17;
scatter x=Xm y=Ym / markerattrs=(symbol=circlefilled size=8pt); * Add hour markers (circles);                               
ellipseparm semimajor=1.15 semiminor=1.15 / nofill lineattrs=(color=black thickness=3pt); * Draw circle border;
text x=Xhr y=Yhr text=txt / rotate=angle contributeoffsets=none strip textattrs=(size=20pt weight=bold); * Draw hours at an angle;
text x=x2 y=y2 text=txt2 / contributeoffsets=none strip textattrs=(size=32pt weight=bold) splitchar='*' splitpolicy=splitalways; * Happy Labor Day message;
xaxis display=none;                                * Suppress axes;
yaxis display=none;
run;

 

1 REPLY 1
tc
Lapis Lazuli | Level 10 tc
Lapis Lazuli | Level 10

Tweak formula to angle=360-hour/24*360-180*(7<=hour<=17) to make bottom hours right-side up like this neat Svalbard Arctic FL24 watch. 😀

 

Working9to17v2.pngSVALBARD_ARCTIC_FL24.jpg

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 842 views
  • 5 likes
  • 1 in conversation