Dear SAS-L-ers,
Here is a way-cool seasonal SAS program that Paul (the Hashman) Dorfman, po=
sted to the 'L some long ago yesteryear.
Simply copy and paste it into a SAS Display Manager session, turn on your s=
peakers, click RUN and smile at some of the fun things we can do with SAS b=
esides solve our organization's business information problems!
data holidays;
retain fmtname '@$holiday';
length data $3;
ratio =3D 1.05946309436;
str1 =3D'A A#B C C#D D#E F F#G G#';
str2=3D'A BbCbB#DbD EbFbE#GbG Ab';
o =3D 1;
do i =3D 0 to 87;
p =3D 55 * ratio**i;
data =3D compress(substr(str1,mod(i,12)*2+1,2)||o);
output;
if data^=3Dcompress(substr(str2,mod(i,12)*2+1,2)||o) then do;
data =3D compress(substr(str2,mod(i,12)*2+1,2)||o);
output;
end;
if mod(i,12)=3D2 then o=3Do+1;
end;
rename data=3Dstart p=3Dlabel;
keep fmtname data p;
run;
proc format cntlin=3Dholidays;
run;
%macro play(input);
data _Null_;
%let i=3D1;
%do %while(%scan(&input,&i,%str( ))^=3D);
%let note =3D %scan(&input,&i,%str( ));
%let pitch =3D %upcase(%scan(¬e,1,=3D));
%let duration =3D %scan(¬e,2,=3D);
%let i =3D %eval(&i+1);
%if &pitch=3DR %then
call sleep((1/&duration)*750);
%else
call sound(input("&pitch",$holiday.),(1/&duration)*300);
;
%end;
run;
%mend;
%play(%str(
C6=3D1 B5=3D1.5 A5=3D6 G5=3D1 R=3D2 F5=3D2 E5=3D1 D5=3D1 C5=3D1
R=3D2 G5=3D2 A5=3D1 R=3D2 A5=3D2 B5=3D1 R=3D2 B5=3D2 C6=3D.33
C6=3D2 C6=3D2 B5=3D2 A5=3D2 G5=3D2 G5=3D1.5 F5=3D4 E5=3D2
C6=3D2 C6=3D2 B5=3D2 A5=3D2 G5=3D2 G5=3D1.5 F5=3D4 E5=3D2 E5=3D2
E5=3D2 E5=3D2 E5=3D2 E5=3D4 F5=3D4 G5=3D1 R=3D4 F5=3D4 E5=3D4
D5=3D2 D5=3D2 D5=3D2 D5=3D4 E5=3D4 F5=3D1 R=3D4 E5=3D4 D5=3D4
C5=3D2 C6=3D1 A5=3D2 G5=3D1.5 F5=3D6 E5=3D2 F5=3D2 E5=3D1 D5=3D1 C5=3D1
));
Best of luck in all of your SAS endeavors!
I hope that this suggestion proves helpful now, and in the future!
Of course, all of these opinions and insights are my own, and do not reflec=
t those of my organization or my associates. All SAS code and/or methodolog=
ies specified in this posting are for illustrative purposes only and no war=
ranty is stated or implied as to their accuracy or applicability. People de=
ciding to use information in this posting do so at their own risk.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Michael A. Raithel
"The man who wrote the book on performance"
E-mail: MichaelRaithel@westat.com
Author: Tuning SAS Applications in the MVS Environment
Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second=
Edition
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=3D1&pc=3D58172
Author: The Complete Guide to SAS Indexes
http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=3D1&pc=3D60409
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Happy New Year to you, your colleagues, and your family! - Michael A. Raith=
el
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
0
|
|
|
|
Reply
|
michaelraithel (1034)
|
12/29/2009 8:29:37 PM |
|
Mike,
I do have to correct the record. This piece was posted by David Ward, whose
presence on SAS-L - and SUGs I attend - I cannot tell you how sorely I miss
ever since he quit the worldly life and dedicated his stupendous talents and
inimitable heart to what he sees as a higher purpose. It was merely my
homage to David that sometime around Christmas of 2007, I offered my own
$.02 in the same spirit and using a little simpler and different language to
code SAS music:
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0712D&L=sas-l&P=R1743
http://www.listserv.uga.edu/cgi-bin/wa?A2=ind0712D&L=sas-l&P=R2457
which operates in exactly same way - just cut, paste, and run.
Happy New Year, Y'all!
Kind regards
------------
Paul Dorfman
Jax, FL
------------
On Tue, 29 Dec 2009 15:29:37 -0500, Michael Raithel
<michaelraithel@WESTAT.COM> wrote:
>Dear SAS-L-ers,
>
>Here is a way-cool seasonal SAS program that Paul (the Hashman) Dorfman,
posted to the 'L some long ago yesteryear.
>
>Simply copy and paste it into a SAS Display Manager session, turn on your
speakers, click RUN and smile at some of the fun things we can do with SAS
besides solve our organization's business information problems!
>
>data holidays;
>
> retain fmtname '@$holiday';
>
> length data $3;
>
> ratio = 1.05946309436;
>
> str1 ='A A#B C C#D D#E F F#G G#';
>
> str2='A BbCbB#DbD EbFbE#GbG Ab';
>
> o = 1;
>
> do i = 0 to 87;
>
> p = 55 * ratio**i;
>
> data = compress(substr(str1,mod(i,12)*2+1,2)||o);
>
> output;
>
> if data^=compress(substr(str2,mod(i,12)*2+1,2)||o) then do;
>
> data = compress(substr(str2,mod(i,12)*2+1,2)||o);
>
> output;
>
> end;
>
> if mod(i,12)=2 then o=o+1;
>
> end;
>
> rename data=start p=label;
>
> keep fmtname data p;
>
>run;
>
>proc format cntlin=holidays;
>
>run;
>
>
>%macro play(input);
>
>data _Null_;
>
> %let i=1;
>
> %do %while(%scan(&input,&i,%str( ))^=);
>
> %let note = %scan(&input,&i,%str( ));
>
> %let pitch = %upcase(%scan(¬e,1,=));
>
> %let duration = %scan(¬e,2,=);
>
> %let i = %eval(&i+1);
>
> %if &pitch=R %then
>
> call sleep((1/&duration)*750);
>
> %else
>
> call sound(input("&pitch",$holiday.),(1/&duration)*300);
>
> ;
>
> %end;
>
>run;
>
>%mend;
>
>%play(%str(
>
>C6=1 B5=1.5 A5=6 G5=1 R=2 F5=2 E5=1 D5=1 C5=1
>
>R=2 G5=2 A5=1 R=2 A5=2 B5=1 R=2 B5=2 C6=.33
>
>C6=2 C6=2 B5=2 A5=2 G5=2 G5=1.5 F5=4 E5=2
>
>C6=2 C6=2 B5=2 A5=2 G5=2 G5=1.5 F5=4 E5=2 E5=2
>
>E5=2 E5=2 E5=2 E5=4 F5=4 G5=1 R=4 F5=4 E5=4
>
>D5=2 D5=2 D5=2 D5=4 E5=4 F5=1 R=4 E5=4 D5=4
>
>C5=2 C6=1 A5=2 G5=1.5 F5=6 E5=2 F5=2 E5=1 D5=1 C5=1
>
>));
>
>Best of luck in all of your SAS endeavors!
>
>
>I hope that this suggestion proves helpful now, and in the future!
>
>Of course, all of these opinions and insights are my own, and do not
reflect those of my organization or my associates. All SAS code and/or
methodologies specified in this posting are for illustrative purposes only
and no warranty is stated or implied as to their accuracy or applicability.
People deciding to use information in this posting do so at their own risk.
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>Michael A. Raithel
>"The man who wrote the book on performance"
>E-mail: MichaelRaithel@westat.com
>
>Author: Tuning SAS Applications in the MVS Environment
>
>Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second
Edition
>http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>
>Author: The Complete Guide to SAS Indexes
>http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>Happy New Year to you, your colleagues, and your family! - Michael A.
Raithel
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
0
|
|
|
|
Reply
|
sashole (976)
|
12/30/2009 4:12:33 AM
|
|
Nice !!
thanks Mike for sharing.
Dani Fernandez.
Barcelona
2009/12/29 Michael Raithel <michaelraithel@westat.com>:
> Dear SAS-L-ers,
>
> Here is a way-cool seasonal SAS program that Paul (the Hashman) Dorfman, posted to the 'L some long ago yesteryear.
>
> Simply copy and paste it into a SAS Display Manager session, turn on your speakers, click RUN and smile at some of the fun things we can do with SAS besides solve our organization's business information problems!
>
> data holidays;
>
> retain fmtname '@$holiday';
>
> length data $3;
>
> ratio = 1.05946309436;
>
> str1 ='A A#B C C#D D#E F F#G G#';
>
> str2='A BbCbB#DbD EbFbE#GbG Ab';
>
> o = 1;
>
> do i = 0 to 87;
>
> p = 55 * ratio**i;
>
> data = compress(substr(str1,mod(i,12)*2+1,2)||o);
>
> output;
>
> if data^=compress(substr(str2,mod(i,12)*2+1,2)||o) then do;
>
> data = compress(substr(str2,mod(i,12)*2+1,2)||o);
>
> output;
>
> end;
>
> if mod(i,12)=2 then o=o+1;
>
> end;
>
> rename data=start p=label;
>
> keep fmtname data p;
>
> run;
>
> proc format cntlin=holidays;
>
> run;
>
>
> %macro play(input);
>
> data _Null_;
>
> %let i=1;
>
> %do %while(%scan(&input,&i,%str( ))^=);
>
> %let note = %scan(&input,&i,%str( ));
>
> %let pitch = %upcase(%scan(¬e,1,=));
>
> %let duration = %scan(¬e,2,=);
>
> %let i = %eval(&i+1);
>
> %if &pitch=R %then
>
> call sleep((1/&duration)*750);
>
> %else
>
> call sound(input("&pitch",$holiday.),(1/&duration)*300);
>
> ;
>
> %end;
>
> run;
>
> %mend;
>
> %play(%str(
>
> C6=1 B5=1.5 A5=6 G5=1 R=2 F5=2 E5=1 D5=1 C5=1
>
> R=2 G5=2 A5=1 R=2 A5=2 B5=1 R=2 B5=2 C6=.33
>
> C6=2 C6=2 B5=2 A5=2 G5=2 G5=1.5 F5=4 E5=2
>
> C6=2 C6=2 B5=2 A5=2 G5=2 G5=1.5 F5=4 E5=2 E5=2
>
> E5=2 E5=2 E5=2 E5=4 F5=4 G5=1 R=4 F5=4 E5=4
>
> D5=2 D5=2 D5=2 D5=4 E5=4 F5=1 R=4 E5=4 D5=4
>
> C5=2 C6=1 A5=2 G5=1.5 F5=6 E5=2 F5=2 E5=1 D5=1 C5=1
>
> ));
>
> Best of luck in all of your SAS endeavors!
>
>
> I hope that this suggestion proves helpful now, and in the future!
>
> Of course, all of these opinions and insights are my own, and do not reflect those of my organization or my associates. All SAS code and/or methodologies specified in this posting are for illustrative purposes only and no warranty is stated or implied as to their accuracy or applicability. People deciding to use information in this posting do so at their own risk.
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Michael A. Raithel
> "The man who wrote the book on performance"
> E-mail: MichaelRaithel@westat.com
>
> Author: Tuning SAS Applications in the MVS Environment
>
> Author: Tuning SAS Applications in the OS/390 and z/OS Environments, Second Edition
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>
> Author: The Complete Guide to SAS Indexes
> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> Happy New Year to you, your colleagues, and your family! - Michael A. Raithel
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
|
|
0
|
|
|
|
Reply
|
fdezdan (222)
|
12/30/2009 4:16:11 PM
|
|
|
2 Replies
186 Views
(page loaded in 0.105 seconds)
|