-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmagic8ball.sas
65 lines (54 loc) · 1.82 KB
/
magic8ball.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
%macro Magic8Ball / des="Ask a question, then use the macro";
/* Temporarily turn the log off */
%local user_mprint user_notes;
%let user_mprint=%sysfunc(getoption(mprint));
%let user_notes=%sysfunc(getoption(notes));
option NOMPRINT;
option NONOTES;
filename junk dummy;
proc printto log=junk; run;
%local response;
data Magic8Ball;
format response $25.;
response="As I see it, yes"; output;
response="It is certain"; output;
response="It is decidedly so"; output;
response="Most likely"; output;
response="Outlook good"; output;
response="Signs point to yes"; output;
response="Without a doubt"; output;
response="Yes"; output;
response="Yes - definitely"; output;
response="You may rely on it"; output;
response="Reply hazy, try again"; output;
response="Ask again later"; output;
response="Better not tell you now"; output;
response="Cannot predict now"; output;
response="Concentrate and ask again"; output;
response="Do not count on it"; output;
response="My reply is no"; output;
response="My sources say no"; output;
response="Outlook not so good"; output;
response="Very doubtful"; output;
run;
data Magic8Ball;
set Magic8Ball;
random=RAND('UNIFORM')*1000000;
run;
proc sort data=Magic8Ball; by random; run;
data Magic8Ball;
set Magic8Ball(obs=1);
call symput('response', response);
run;
dm "postmessage '&response'";
proc sql;
drop table Magic8Ball;
quit;
/* Turn the log back on */
proc printto; run;
option &user_notes;
option &user_mprint;
%mend Magic8Ball;
/*
%Magic8Ball;
*/