Type : SASHELP
Los datos provienen exclusivamente de la biblioteca SASHELP (tablas class, shoes, cars).
| 1 | DATA class; |
| 2 | SET sashelp.class; |
| 3 | const = 1; |
| 4 | RUN; |
| 1 | PROC SORT DATA=class; BY const sex;RUN; |
| 1 | DATA shoes; |
| 2 | SET sashelp.shoes; |
| 3 | WHERE region in ('Canada', 'Pacific'); |
| 4 | RUN; |
| 1 | PROC SORT DATA=shoes; BY region product; RUN; |
| 1 | DATA cars; |
| 2 | SET sashelp.cars; |
| 3 | const = 1; |
| 4 | RUN; |
| 1 | ODS _ALL_ CLOSE; |
| 2 | |
| 3 | * start new ODS DOCUMENT; |
| 4 | ODS DOCUMENT NAME=doc_results(WRITE); |
| 1 | ODS PROCLABEL="Table 1: By Group Report about shoes"; |
| 2 | TITLE "Table 1: By Group Report about shoes"; |
| 3 | PROC REPORT DATA=shoes CONTENTS=""; |
| 4 | BY region; |
| 5 | COLUMN region product sales; |
| 6 | DEFINE region / ORDER NOPRINT; |
| 7 | BREAK BEFORE region / CONTENTS="" page; |
| 8 | RUN; |
| 1 | TITLE "Table 2: Table Class Output"; |
| 2 | ODS PROCLABEL "Table 2: Table Class Output"; |
| 3 | PROC REPORT DATA=class CONTENTS=""; |
| 4 | COLUMN const name sex age height weight; |
| 5 | DEFINE const / ORDER NOPRINT; |
| 6 | BREAK BEFORE const / CONTENTS="" page; |
| 7 | RUN; |
| 1 | %MACRO loopTroughMake(make,i); |
| 2 | TITLE "Table &i: Multiple outputs - Cars for make = &make"; |
| 3 | ODS PROCLABEL "Table &i: Multiple outputs - Cars for make = &make"; |
| 4 | PROC REPORT DATA=cars(WHERE=(make = "&make")) nowd headline spacing=2 CONTENTS=""; |
| 5 | COLUMN const make model type msrp; |
| 6 | DEFINE const / ORDER NOPRINT; |
| 7 | BREAK BEFORE const / CONTENTS="" page; |
| 8 | RUN; |
| 9 | TITLE; |
| 10 | %MEND; |
| 1 | %loopTroughMake(Acura,3); |
| 2 | %loopTroughMake(Audi,4); |
| 3 | %loopTroughMake(BMW,5); |
| 4 |
| 1 | ODS PROCLABEL="Table 6: Different label"; |
| 2 | TITLE "Table 6: Different title and label"; |
| 3 | PROC REPORT DATA=class CONTENTS=""; |
| 4 | COLUMN const name sex age height weight; |
| 5 | DEFINE const / ORDER NOPRINT; |
| 6 | BREAK BEFORE const / CONTENTS="" page; |
| 7 | RUN; |
| 1 | ODS PROCLABEL="Figure 1: Class graphic"; |
| 2 | PROC SGPLOT DATA = sashelp.class; |
| 3 | VBAR age / GROUP = sex; |
| 4 | TITLE 'Figure 1: Class overview by sex and age'; |
| 5 | RUN; |
| 1 | ODS DOCUMENT CLOSE; |