-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcode for myPackage with tags.sas
223 lines (168 loc) · 4.75 KB
/
code for myPackage with tags.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
/*##$##-CODE-BLOCK-START-##$## 001_macro(marvelmacro) */
/* marvelmacro macro */
%macro marvelmacro(hero)/secure;
%if %superq(hero)=HULK %then
%do;
%put "Hulk will, Hulk will... smash you!";
%goto EOM;
%end;
%if %superq(hero)=IRONMAN %then
%do;
%put "I'm not a superhero type...";
%put "The truth is... I am Iron Man.";
%goto EOM;
%end;
%if %superq(hero)=DEADPOOL %then
%do;
%put "I'll draw a Unicorn for Logan <3 B-] <3";
%goto EOM;
%end;
%if %superq(hero)=STARLORD %then
%do;
%put "Squeak, squeak..";
%put ,.!.. ;
%put "Oh, I'm sorry. I didn't know how this machine worked.";
%goto EOM;
%end;
%put Hey %superq(hero)! Tina says: "We don't need another heeeeroooo!!!";
%EOM:
%mend marvelmacro;
/*
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
%marvelmacro(IRONMAN);
%marvelmacro(HULK);
%marvelmacro(STARLORD);
%marvelmacro(DEADPOOL);
%marvelmacro(BART);
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
*/
/*##$##-CODE-BLOCK-END-##$## 001_macro(marvelmacro) */
/*##$##-CODE-BLOCK-START-##$## 001_macro(dcmacro) */
/* dcmacro macro */
%macro dcmacro(hero)/secure;
%put Hey %superq(hero)! Why so serious?!?!;
%mend dcmacro;
/*
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
%dcmacro(BATMAN)
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
*/
/*##$##-CODE-BLOCK-END-##$## 001_macro(dcmacro) */
/* fastformat format & furiousfunction function & f_and_f data */
proc format;
/*##$##-CODE-BLOCK-START-##$## 002_formats(fastformat) */
value $ fastformat (default=8)
"VIN" = "Diesel"
other = "Gasoline"
;
/*##$##-CODE-BLOCK-END-##$## 002_formats(fastformat) */
run;
/**/
proc FCMP outlib = work.f.p;
/*##$##-CODE-BLOCK-START-##$## 003_functions(furiousfunction) */
function furiousfunction(user $,value) $;
length result $ 128;
result = catx(" ",
user,
"is",
put(value/100, percent12.),
put(upcase(user), $fastformat.)
);
return(result);
endfunc;
/*##$##-CODE-BLOCK-END-##$## 003_functions(furiousfunction) */
run;
options cmplib=work.f;
/**/
/*##$##-CODE-BLOCK-START-##$## 004_data(F_and_F) */
data F_and_F;
infile cards dlm=',';
input name $ value;
text = furiousfunction(name, value);
cards;
Vin,100
The Rock,99
;
run;
/*##$##-CODE-BLOCK-END-##$## 004_data(F_and_F) */
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
/* */
proc print data=F_and_F noobs;
var text;
run;
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
/* infamous informat AND format ! */
proc format;
/*##$##-CODE-BLOCK-START-##$## 002_formats(infamous) */
invalue infamous (default=8 upcase)
"THE GOOD" = 1
"THE BAD" = -1
"THE UGLY" = 0
other = .
;
value infamous (default=8)
0<-HIGH = "THE GOOD"
LOW-<0 = "THE BAD"
other = "THE UGLY"
;
/*##$##-CODE-BLOCK-END-##$## 002_formats(infamous) */
run;
/*##$##-CODE-BLOCK-START-##$## 004_data(Sergio) */
data Sergio;
infile cards dlm=",";
input x :infamous. y;
format y infamous.;
cards;
the good, 42
THE BAD, -17
tHe UgLy, 0
;
run;
/*##$##-CODE-BLOCK-END-##$## 004_data(Sergio) */
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
proc print data=Sergio label;
run;
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
/* supercool macro*/
/*##$##-CODE-BLOCK-START-##$## 001_macro(supercool) */
%macro supercool(you,data,what);
%put Hey %superq(you)! My %superq(data) is %superq(what) than your %superq(data)!;
%mend supercool;
/*##$##-CODE-BLOCK-END-##$## 001_macro(supercool) */
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
%supercool(Python, code, faster)
%supercool(Excel, table, bigger)
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
/*##$##-CODE-BLOCK-START-##$## 005_lazydata(supercool) */
/* supercool data */
data supercool;
dataCool = "Data, data cool! This data is Super Cool!";
label
dataCool = "Label for Super Cool data";
run;
/*##$##-CODE-BLOCK-END-##$## 005_lazydata(supercool) */
/*##$##-CODE-BLOCK-START-##$## !to_ignore(ignore) */
proc print data=supercool label;
run;
/*##$##-CODE-BLOCK-END-##$## !to_ignore(ignore) */
/* supercool function */
proc FCMP outlib = work.f.p;
/*##$##-CODE-BLOCK-START-##$## 003_functions(supercool) */
function supercool(data $) $;
return(catx(" ", quote(data), "is Super Cool!"));
endfunc;
/*##$##-CODE-BLOCK-END-##$## 003_functions(supercool) */
run;
options cmplib=work.f;
/*##$##-CODE-BLOCK-START-##$## 999_test(test) */
data _null_;
x = supercool("WUSS Conference 2023");
put x=;
run;
/*##$##-CODE-BLOCK-END-##$## 999_test(test) */
/*##$##-CODE-BLOCK-START-##$## _ALL_(_ALL_) */
/*
This comment will be populated to ALL files
in ALL directories.
*/
/*##$##-CODE-BLOCK-END-##$## _ALL_(_ALL_) */