options mcompilenote=ALL symbolgen mprint;
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
208 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
208! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
209
210 options mcompilenote=ALL symbolgen mprint;
211
212 ods html5 (id=saspy_internal) close;ods listing;
213
libname pa "/folders/myfolders/libToPlot1";
libname pb "/folders/myfolders/libToPlot2";
libname pc "/folders/myfolders/libToPlot3";
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
215 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
215! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
216
217 libname pa "/folders/myfolders/libToPlot1";
NOTE: Libref PA refers to the same physical library as ABC.
NOTE: Libref PA was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myfolders/libToPlot1
218 libname pb "/folders/myfolders/libToPlot2";
NOTE: Libref PB refers to the same physical library as BC.
NOTE: Libref PB was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myfolders/libToPlot2
219 libname pc "/folders/myfolders/libToPlot3";
NOTE: Libref PC refers to the same physical library as BC.
NOTE: Libref PC was successfully assigned as follows:
Engine: V9
Physical Name: /folders/myfolders/libToPlot3
220
221 ods html5 (id=saspy_internal) close;ods listing;
222
/*concatenate the libraries*/
libname abc (pa, pb, pc);
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
224 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
224! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
225
226 /*concatenate the libraries*/
227
228 libname abc (pa, pb, pc);
NOTE: Libref ABC was successfully assigned as follows:
Levels: 3
Engine(1): V9
Physical Name(1): /folders/myfolders/libToPlot1
Engine(2): V9
Physical Name(2): /folders/myfolders/libToPlot2
Engine(3): V9
Physical Name(3): /folders/myfolders/libToPlot3
229
230 ods html5 (id=saspy_internal) close;ods listing;
231
proc contents data=abc._all_ nods;
run;
<!DOCTYPE html>
The CONTENTS Procedure
| Directory | |
|---|---|
| Libref | ABC |
| Levels | 3 |
| Level 1 | |
|---|---|
| Engine | V9 |
| Physical Name | /folders/myfolders/libToPlot1 |
| Filename | /folders/myfolders/libToPlot1 |
| Inode Number | 968 |
| Access Permission | rwxrwx— |
| Owner Name | root |
| File Size | 4KB |
| File Size (bytes) | 4096 |
| Level 2 | |
|---|---|
| Engine | V9 |
| Physical Name | /folders/myfolders/libToPlot2 |
| Filename | /folders/myfolders/libToPlot2 |
| Inode Number | 969 |
| Access Permission | rwxrwx— |
| Owner Name | root |
| File Size | 4KB |
| File Size (bytes) | 4096 |
| Level 3 | |
|---|---|
| Engine | V9 |
| Physical Name | /folders/myfolders/libToPlot3 |
| Filename | /folders/myfolders/libToPlot3 |
| Inode Number | 970 |
| Access Permission | rwxrwx— |
| Owner Name | root |
| File Size | 4KB |
| File Size (bytes) | 4096 |
| # | Name | Member Type | Level | File Size | Last Modified |
|---|---|---|---|---|---|
| 1 | BMIMEN | DATA | 2 | 128KB | 07/09/2020 15:33:34 |
| 2 | CLASS | DATA | 1 | 128KB | 07/09/2020 15:08:43 |
| 3 | FISH | DATA | 1 | 128KB | 07/09/2020 15:28:44 |
| 4 | GAS | DATA | 2 | 128KB | 07/09/2020 15:35:44 |
| 5 | GNP | DATA | 1 | 128KB | 07/09/2020 15:29:45 |
| 6 | IRIS | DATA | 3 | 128KB | 07/09/2020 15:36:46 |
| 7 | LAKE | DATA | 3 | 128KB | 07/09/2020 15:38:03 |
| 8 | ORSALES | DATA | 2 | 192KB | 07/09/2020 19:36:38 |
| 9 | SHOES | DATA | 3 | 128KB | 07/09/2020 15:40:42 |
/* One macro calls another macro */
%macro hbox_for_a_df(df);
%local i;
%let dfn=%scan(&df, -1);
data &dfn;
set &df;
keep _numeric_;
run;
%let dfn=%upcase(&dfn);
data _null_;
set sashelp.vcolumn end=final;
where libname="WORK" and memname="&dfn";
call symputx('col'||left(_n_), name);
if final then call symputx('totalcol', _n_);
run;
%do i=1 %to &totalcol;
ods graphics on/noborder;
proc sgplot data=&dfn;
hbox &&col&i;
title "Boxplot for %upcase(&&col&i) from data set %upcase(&dfn)";
run;
title;
ods graphics off;
%end;
%mend ;
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
241 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
241! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
242
243 /* One macro calls another macro */
244
245 %macro hbox_for_a_df(df);
246
247 %local i;
248
249
250 %let dfn=%scan(&df, -1);
251
252
253 data &dfn;
254
255 set &df;
256
257 keep _numeric_;
258 run;
259
260
261 %let dfn=%upcase(&dfn);
262
263
264 data _null_;
265
266 set sashelp.vcolumn end=final;
267
268 where libname="WORK" and memname="&dfn";
269
270 call symputx('col'||left(_n_), name);
271
272 if final then call symputx('totalcol', _n_);
273
274 run;
275
276
277
278 %do i=1 %to &totalcol;
279
280 ods graphics on/noborder;
281
282 proc sgplot data=&dfn;
283
284 hbox &&col&i;
285
286 title "Boxplot for %upcase(&&col&i) from data set %upcase(&dfn)";
287
288 run;
289
290 title;
291
292 ods graphics off;
293
294 %end;
295
296
297 %mend ;
NOTE: The macro HBOX_FOR_A_DF completed compilation without errors.
34 instructions 1160 bytes.
298
299 ods html5 (id=saspy_internal) close;ods listing;
300
%hbox_for_a_df(pc.iris)
<!DOCTYPE html>
/*This macro calls the previous macro (hbox_for_a_df) and uses a do `while loop` to traverse through a list of data sets.*/
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
309 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
309! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
310
311 /*This macro calls the previous macro (hbox_for_a_df) and uses a do `while loop` to traverse through a list of data sets.*/
312
313 ods html5 (id=saspy_internal) close;ods listing;
314
%macro hbox_for_each_df_in_a_lib(lib=x);
%local i lib;
%let lib=%upcase(&lib);
proc sql noprint;
select cats("&lib..", memname)
into :ds_name_list separated by ' '
from dictionary.tables
where libname="&lib";
quit;
%let i=1;
data _null_;
%do %while (%scan(&ds_name_list, &i, %str( )) ne ); /*scan the ds_name_list delimited by a space: %str() */
%let next_ds_name = %scan(&ds_name_list, &i, %str( ));
%hbox_for_a_df(&next_ds_name)
%let i = %eval(&i + 1);
%end;
run;
%mend;
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
316 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
316! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
317
318 %macro hbox_for_each_df_in_a_lib(lib=x);
319
320 %local i lib;
321
322
323 %let lib=%upcase(&lib);
324
325
326 proc sql noprint;
327
328 select cats("&lib..", memname)
329
330 into :ds_name_list separated by ' '
331
332 from dictionary.tables
333
334 where libname="&lib";
335 quit;
336
337
338 %let i=1;
339
340
341 data _null_;
342
343 %do %while (%scan(&ds_name_list, &i, %str( )) ne ); /*scan the ds_name_list delimited by a space: %str() */
344
345 %let next_ds_name = %scan(&ds_name_list, &i, %str( ));
346
347 %hbox_for_a_df(&next_ds_name)
348
349 %let i = %eval(&i + 1);
350
351 %end;
352
353 run;
354
355
356 %mend;
NOTE: The macro HBOX_FOR_EACH_DF_IN_A_LIB completed compilation without errors.
47 instructions 1216 bytes.
357
358 ods html5 (id=saspy_internal) close;ods listing;
359
%hbox_for_each_df_in_a_lib(lib=pa)
<!DOCTYPE html>
libname bc (pb, pc);
<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
368 ods listing close;ods html5 (id=saspy_internal) file=stdout options(bitmap_mode='inline') device=svg style=HTMLBlue; ods
368! graphics on / outputfmt=png;
NOTE: Writing HTML5(SASPY_INTERNAL) Body file: STDOUT
369
370 libname bc (pb, pc);
NOTE: Libref BC was successfully assigned as follows:
Levels: 2
Engine(1): V9
Physical Name(1): /folders/myfolders/libToPlot2
Engine(2): V9
Physical Name(2): /folders/myfolders/libToPlot3
371
372 ods html5 (id=saspy_internal) close;ods listing;
373
%hbox_for_each_df_in_a_lib(lib=bc)
<!DOCTYPE html>