- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It's nearly July 17, also known as #WorldEmojiDay! In this challenge, the famous CLASS data set received an update for the modern times we live in. We still have student names, but all other attributes have been replaced with emojis. We've now got fields for gender (we don't use the term "sex" anymore), current mood, "spirit" animal, and appointment time.
Snippet of the new CLASS
You'll find the new data set attached as a CSV file (modern_class.csv) to this message. Your job is to read the new class data into SAS and "translate" the emoji fields into words (presumably so that people who don't "speak emoji" can read it). Create a SAS report (PROC PRINT is fine) that contains the "wordy" version of the data. Show your code and results in your replies.
Hints/Notes:
- This blog post teaches you how to work with emojis in SAS, and provides sample code you can use to retrieve the definitions and codes for all emojis. The most robust solution will be able to process any emoji encountered in the data.
- You will need to use a SAS session with UTF-8 encoding. If you use SAS OnDemand for Academics it's UTF-8 by default. And SAS Viya is always UTF-8. Emojis rely on Unicode, so limited encodings like wlatin1 will not be able to process these data.
- Keep in mind that modern systems are not limited to "male" and "female" for gender, and neither is this updated CLASS data set.
(Note: last year we shared this challenge on SAS Analytics Explorers. Decided to share with a wider audience this time!)
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The clocks made that interesting.
data appt_time;
fmtname='$appt_time';
do i=128336 to 128347;
start=unicode(cats('&#',i,';'),'ncr');
label=put(mod(i,128335)*3600,hhmm.);
output;
end;
do i=128348 to 128359;
start=unicode(cats('&#',i,';'),'ncr');
label=put(mod(i,128347)*3600+1800,hhmm.);
output;
end;
run;
proc format lib=work cntlin=work.appt_time;
run;
proc format;
value $gender
👦='Male'
👧='Female'
🧒='Non-Binary'
other='Undefined'
;
/* and so on for the rest */
run;
data modern_class;
infile datalines dlm=',' dsd truncover;
input (name gender mood animal appt_time) ($);
datalines;
Alfred,👦,😏,🦄,🕛
Alice,👧,😒,🦓,🕧
Barbara,👧,🙄,🦌,🕐
Carol,🧒,😬,🦬,🕜
Henry,👦,🤥,🐮,🕑
James,👦,😌,🐂,🕝
Jane,👧,😔,🐃,🕒
Janet,🧒,😪,🐄,🕞
Jeffrey,👦,🤤,🐷,🕓
John,👦,😴,🐖,🕟
Joyce,👧,😒,🐗,🕔
Judy,🧒,🙄,🐽,🕠
Louise,👧,😬,🐏,🕕
Mary,👧,😌,🐑,🕡
Philip,👦,😔,🐐,🕖
Robert,🧒,😪,🐪,🕢
Ronald,👦,😏,🐫,🕗
Thomas,👦,😒,🦙,🕣
William,👦,🙄,🦒,🕘
;
proc print data=modern_class;
format gender $gender. appt_time $appt_time.;
run;