Happy Labor Day
Q. What do you get when you combine labor-related icons from The Noun Project with 5x7 LED mappings from a hobbyist's C code? A. An 'iconic' Labor Day greeting. Enjoy the long weekend!
Happy Labor Day
Give Me An "H"!
Construction Worker
CODE
* Fun with SAS ODS Graphics: 5x7 LED matrix display-inspired 'iconic' Labor Day greeting
5X7 LED matrix character mapping courtesy by "gerryc" ccsinfo.com/forum/viewtopic.php?p=24141#24141
Labor-related icon thumbnails from the Noun Project thenounproject.com;
*==> 1. Get x/y coordinates of "on" points from 5x7 LED hex alphabet mapping (found in a C program);
data LED5x7(keep=letter x y);
length letter $ 1.;
input;
letter=scan(_infile_,-1); * Letter is at end of each input record;
do y=1 to 7; * One hex constant represents each display line;
bits=put(input(substr(_infile_,7+(y-1)*6,2),$hex2.),$binary8.);
do i=4 to 8; * Rightmost 5 bits of each contant indicate which points are "on" in each line;
x=i-3;
if substr(bits,i,1) then output; * Only need x/y pairs of points that are "on";
end;
end;
datalines; /* C code snippet w/LED character mapping - rightmost 5 bits of each constant indicate "on" bits for eachline */
{0x04, 0x0a, 0x11, 0x11, 0x1f, 0x11, 0x11,} // 0x41, A
{0x1e, 0x11, 0x11, 0x1e, 0x11, 0x11, 0x1e,} // 0x42, B
{0x0e, 0x11, 0x10, 0x10, 0x10, 0x11, 0x0e,} // 0x43, C
{0x1e, 0x09, 0x09, 0x09, 0x09, 0x09, 0x1e,} // 0x44, D
{0x1f, 0x10, 0x10, 0x1c, 0x10, 0x10, 0x1f,} // 0x45, E
{0x1f, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10,} // 0x46, F
{0x0e, 0x11, 0x10, 0x10, 0x13, 0x11, 0x0f,} // 0x37, G
{0x11, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11,} // 0x48, H
{0x0e, 0x04, 0x04, 0x04, 0x04, 0x04, 0x0e,} // 0x49, I
{0x1f, 0x02, 0x02, 0x02, 0x02, 0x12, 0x0c,} // 0x4a, J
{0x11, 0x12, 0x14, 0x18, 0x14, 0x12, 0x11,} // 0x4b, K
{0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f,} // 0x4c, L
{0x11, 0x1b, 0x15, 0x11, 0x11, 0x11, 0x11,} // 0x4d, M
{0x11, 0x11, 0x19, 0x15, 0x13, 0x11, 0x11,} // 0x4e, N
{0x0e, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e,} // 0x4f, O
{0x1e, 0x11, 0x11, 0x1e, 0x10, 0x10, 0x10,} // 0x50, P
{0x0e, 0x11, 0x11, 0x11, 0x15, 0x12, 0x0d,} // 0x51, Q
{0x1e, 0x11, 0x11, 0x1e, 0x14, 0x12, 0x11,} // 0x52, R
{0x0e, 0x11, 0x10, 0x0e, 0x01, 0x11, 0x0e,} // 0x53, S
{0x1f, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,} // 0x54, T
{0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x0e,} // 0x55, U
{0x11, 0x11, 0x11, 0x11, 0x11, 0x0a, 0x04,} // 0x56, V
{0x11, 0x11, 0x11, 0x15, 0x15, 0x1b, 0x11,} // 0x57, W
{0x11, 0x11, 0x0a, 0x04, 0x0a, 0x11, 0x11,} // 0x58, X
{0x11, 0x11, 0x0a, 0x04, 0x04, 0x04, 0x04,} // 0x59, Y
{0x1f, 0x01, 0x02, 0x04, 0x08, 0x10, 0x1f,} // 0x5a, Z
;
*==> 2. Get message to be displayed;
data message(keep=n letter);
input word $char5.;
do i=1 to 5; * Max of 5 characters wide;
n+1; * Letter sequence number;
letter=substr(word,i,1);
output;
end;
datalines;
HAPPY
LABOR
DAY
;
*==> 3. Merge letters in message with the x/y points that represent them;
proc sql;
create table message5x7 as
select m.n, m.letter, /* Force x/y points of spaces outside of visible chart range (99, 99) */
case when l.letter is null then 99 else l.x end as x,
case when l.letter is null then 99 else l.y end as y
from message m left join LED5x7 l on m.letter=l.letter
order by m.n, y, x;
data message5x7icon; * Assign a labor-related icon to each point;
set message5x7;
icon=mod(_n_-1,20)+1; * One of twenty icons;
*==> 5. Macro to assign 20 labor-related images (jobs) to sympbols for use as markers in scatter plots;
%let datasymbols=;
%macro gensymbols;
%do j=1 %to 20; * 20 labor-related thumbnail icons;
%let img=%scan(attorney carpenter cashier constructionworker cook customerservice delivery doctor driver farmer
firefighter mailman mechanic officeworker programmer scientist security soldier teacher truckdriver,&j);
symbolimage name=&img
image="/folders/myfolders/laborday/&img..png";
%let datasymbols=&datasymbols &img;
%end;
%mend;
*==> 6. Display message using panel of scatter charts (1 chart per letter)
Each letter is a 5x7 LED-like scatter chart of labor-related icons;
ods _all_ close;
ods html body='/folders/myfolders/work/laborday.htm' gpath='/folders/myfolders/work' image_dpi=300;
ods graphics / reset imagename="laborday" height=7.5in width=7.5in attrpriority=none antialias outputfmt=png;
proc sgpanel data=message5x7icon noautolegend;
panelby n / columns=5 noborder novarname noheader spacing=8;
%gensymbols;
styleattrs datasymbols=(&datasymbols);
scatter x=x y=y / group=icon markerattrs=(size=20pt);
colaxis display=none min=.5 max=5.5 offsetmin=0 offsetmax=0 thresholdmin=0 thresholdmax=0;
rowaxis display=none min=.5 max=7.5 reverse offsetmin=0 offsetmax=0 thresholdmin=0 thresholdmax=0;
refline .5 to 5.5 by 1 / axis=x lineattrs=(color=gray);
refline .5 to 7.5 by 1 / axis=y lineattrs=(color=gray);
run;
ods html close;
Credits: Icons are small thumbnails of larger images available at The Noun Project:
Doctor By Adrien Coquet, FR
truck driver By Gan Khoon Lay
Teacher By arif fajar yulianto, ID
Farmer By Luis Prado, US
Office By Alexander Skowalsky, HU
Mailman By Gerald Wildmoser, DE
cooking By Alice Design
security officer By throwaway icons
retailer By Gan Khoon Lay
Mechanic By Mask Icon, ID
pizza delivery By Luis Prado, US
Scientist By MHD AZMI DWIPRANATA, ID
Carpenter By Dan Hetteix, US
Firefighter By Joshua Jones, GB
soldier By Simon Child, GB
attorney By ProSymbols, US
computer programmer By Aneeque Ahmed
customer service By Wilson Joseph
construction worker By Wilson Joseph
Driver By jauhari, MY
Shades of custom character sets from the days of 9-pin and similar impact printers.
Fun.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.