On this Talk Like A Pirate Day, I decided to share a fun example of how to use SAS and a fun free API to generate some pirate-y insults and translations. For these I'm leveraging the APIs I found here: https://pirate.monkeyness.com/api.html.
The format is simple: use PROC HTTP to call the API, capture the output in a text file, and then read that into a data set:
filename rrr temp;
proc http
url="https://pirate.monkeyness.com/api/insult"
out=rrr;
run;
data insult;
infile rrr;
length insult $ 255;
input;
insult=_infile_;
run;
filename rrr clear;
Run that once to get one good-natured pirate insult. Want a bunch of these? Here's a macro routine to get more:
/* Insults! */
%macro pirateInsults(howMany);
%do i=1 %to &howMany.;
filename rrr temp;
proc http
url="https://pirate.monkeyness.com/api/insult"
out=rrr;
run;
data r_&i;
infile rrr;
length insult $ 255;
input;
insult=_infile_;
run;
filename rrr clear;
%end;
/* combine insults into compendium */
data insults;
set r_:;
run;
/* delete temp data */
proc datasets lib=work nodetails nolist;
delete r_:;
quit;
%mend;
%pirateInsults(5);

This team offers a similar API for translations. This code translates English to "Pirate":
%let phrase=Hey! You! Get off of my boat.;
filename rrr temp;
proc http
url="https://pirate.monkeyness.com/api/translate?english=%sysfunc(urlencode(&phrase))"
out=rrr;
run;
data r;
infile rrr;
length insult $ 255;
input;
insult=_infile_;
run;
filename rrr clear;
Output: "Ahoy! Ye! Get off o' me ship."
We can drive more phrases through using SAS macro and CALL EXECUTE.
data inputs;
infile datalines dsd;
length english $ 200;
input english;
datalines;
I know what you did
Get your hands off of my treasure
Hey! You! Get off of my boat.
;
run;
%macro pirateTranslate(phrase,n);
filename rrr temp;
proc http
url="https://pirate.monkeyness.com/api/translate?english=%sysfunc(urlencode(&phrase))"
out=rrr;
run;
data r_&n;
infile rrr;
length pirate $ 255;
input;
pirate=_infile_;
run;
filename rrr clear;
%mend;
data _null_;
set inputs;
call execute('%pirateTranslate('||english||','||_n_||');');
run;
data allTranslations;
set r_:;
run;
/* delete temp data */
proc datasets lib=work nodetails nolist;
delete r_:;
quit;

Got your own examples? Ahoy! Share it w' the crew!