| Date: | Fri, 21 Dec 2007 13:35:49 -0600 |
| Reply-To: | Duck-Hye Yang <dyang@CHAPINHALL.ORG> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Duck-Hye Yang <dyang@CHAPINHALL.ORG> |
| Subject: | Re: OT: SAS Christmas Carol |
|
| In-Reply-To: | <403593359CA56C4CAE1F8F4F00DCFE7D0A154330@MAILBE2.westat.com> |
| Content-Type: | text/plain; charset=US-ASCII |
This does not seem to work on Unix platform... Or did I do something more???
Thanks,
Duckhye
>>> Michael Raithel <michaelraithel@WESTAT.COM> 12/21/2007 10:53 AM >>>
Dear SAS-L-ers,
Here is a SAS program that plays a Christmas carol. It was posted on
the 'L a while ago, but I can't remember who originally posted it. Turn
your workstation speakers on if/when you execute it.
I would love to have other holiday/non-holiday SAS program songs. So,
if you have one or more, please post it/them.
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
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Don't accept your dog's admiration as conclusive evidence that you are
wonderful. - Ann Landers
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|