interactive report generation 'design a saved.demograf · 2012. 9. 9. · select...
TRANSCRIPT
Interactive Report Generation
From the report. .. '
click on the
Select SAVED.DEMOGRAF AS THE 'Active data set:'
option. Select 'Design a
Run it and the prompter will appear. You can restrict the number of observations used to interactively create the report.
Click since this is a small table.
The next screen prompts you for the columns to be displayed on the report from left to right.
354
Select the order.
Click on the File pulldown and
The following report is displayed.
355
MNIIIM 8TMUB ME Qllt.DfiEN F " 52 5 F .. 48 3 F " !8 3 F " 28 8 F " " 8 F " 54 3 F " 80 8 F " 8! 2 F " 34 2 F " 34 2 F " 38 2 F " 115 2 F D " ! F 8EP u I F " 211 I F 8 1! 0 F 8 18 0 F 8 s 0 F 8 22 0 F 8 80 0 F " ss 0
" " ... 5 II " 34 4 II II 34 3 II D 44 3 II 8EP 55 2
" 28 2
" 38 2 II 40 ! D 25 2 8 11 0 8 2 • 8 14 • 8 23 0 8 33 0
and you are prompted to define each column.
Click on each of the prompt screens to accept the defaults. Notice character columns are automatically set to DISPLAY while numeric columns are automatically set to ANALYSIS.
For better display, change the default line size (width) to about 80 for this demonstration.
Click on the Tools pulldown, Options and System.
356
Select SAS Log and Procedure Output.
~ Dll~ 411 I n 1 n 1 Sli • 154 • 10 I • z M r M r • e a I H Z n 1 n 1 II 0 II t • • ft • .. . Sli •
'" 5 M 4
" .... Sli n II 4t IS II I
14 n 13
357
~ ·..... ..... • ..... • 1-• I lOot • I-I .... .... ..... .... • • • . .... ..... 1--·-I-I-1--·..... • • • 1 .... re"
Double click on Linesize and change it to 80.
Select .. when finished.
Refresh the report by selecting the View pull down and
358
GEfllER 81'1'11UB ME CHIUliiEN 8N..IIRY F II 52 s 15000 F .. 46 a 110000 F II 28 a 15000 F II 2a a 0 F II 56 a lltOOO F II 54 a 0 F II 10 a 18000 F II a2 2 0 F II 84 2 18000 F II 84 2 0 F II 88 2 10000 F II 15 2 10000 F D 28 2 8000 F rEP 28 1 11000 F II n 1 5100 F 8 12 0 0 F 8 II 0 0 F 8 I& • • F 8 22 • 11000 F 8 liO 0 aoooo F II 56 • 15000 II II 48 s 8000 II II ll4 .. 40000 II II 84 a nooo II D .... a 10000 II rEP ss 2 12000 II II 28 2 12000 II II as 2 28000 II II 40 2 1000 II D 25 2 10000 II 8 II 0 • II 8 2 • • II 8 14 0 • II 8 21 0 10000 II 8 88 0 7800
Let's enhance the report. Let's order the data and add subtotals and grand totals.
Highlight the Gender column.
359
8Tfttu8 fiGE tHilllfiEN M.IIR'I' II 51 s 154100 .. 46 8 ••o II II 8 t5oeo II 28 8 0 II ss 8 IIOH II S4 a 0 II 60 a 180H II 81 2 0
" 34 2 111000 II 34 2 • II 81 2 10000 II 65 2 10000 0 19 2 .... 8EP 28 1 11000 II 28 1 5600 8 12 0 0 8 18 0 0 8 8 0 0 8 " 0 18000 8 80 0 80000
" 56 0 15000 II ... 5 IHO
" " .. 41000 II " 8 28000 D .... a 10010 8EP 55 2 12000
" 28 2 12010
" 36 2 2aOIO II 40 2 12800 D IS l 10000 8 II 0 0 8 2 0 0 8 14 0 0 8 u • 10001 8 88 0 7100
Click the Edit pull down and
The following screen appears, allowing you to define the highlighted column.
360
Change it to modify the Usage to be Order and change the Header label.
Click to see the results immediately and when done.
361
8TftTll8 MlE OIILiliEN M..NIY D 29 2 8080 II 52 5 15080
18 8 15000 18 a • Sl a 30000 54 a 0 .. 3 13000 81 2 • 84 I 18000 84 2 0 38 2 1ooeo 65 2 18000 26 1 SI80 56 • 15000
8 12 • • 16 0 • 6 • • 22 • 13000 30 0
8EP I II a
II D
Notice how both GENDER and STATUS were both redefined as Order.
Change the Age column's default statistic to Mean.
362
8TIITU8 CHII..DIIEM IMLMT D 2 .... II s ISOOO
I tsooo I 0 I ltOOO I 0 I 11000 2 0 2 11000 2 0 2 10000 2 10000 1 SIOO • 15000
8 • 0 • 0 • 0 • 11000 • 80000 8EP 1 11000 .. I 30000
II D I ..... 2 10000
II s .... .. ...... I uooo 2 12000 2 21000 2 121t0
B 0 0 • 0 0 0 0 10000 • , ...
8EP 2 12000
Type a ? in the statistic field to see the possible statistics.
363
0 0
18000 80000
8EP 18000 II 30000
II D 10000 10000
II 8000 40000 28000 12000 28000 12800
8 0 0 0
10000 7800
2 12000
Select Mean, the File pull down, and change the header label.
364
Click when finished.
Now, let's add subtotals to the Gender Level. Highlight the Gender column.
8TI!I1'U8 :y: or
CHIUIIEN 8fii.NIT D
&pov;; ! 8000
" 52 s 15000 !8 a 15000 !3 a 0 58 8 30000 54 8 0 60 3 13000 32 ! 0 M ! 18000 M 2 0 38 2 10000 85 ! 10000 !8 1 5800 58 0 15000
8 1! 0 0 18 0 0 8 0 0
!! 0 13000 30 0 30000
8EP 23 1 18000 N 48 8 30000 D .... 8 10000
25 2 10000
" 48 5 8000 M 4 40000 M a 23000 n 2 12000 38 2 23000 40 2 12300
8 11 0 0 ! 0 0
14 0 0 23 0 10000 38 0 1800 56 2 12000
365
Select the Edit pull down, Summarize information, After Item.
£lop "r'ov:! H Sl!
" Zll 1511 54 •• 82 84 84
" IS H
" II II I
H 10 18 45 44 zs •• 84 84 ZB aa 40 II z
14 Zll 13 55
CHII.IliEII ! 5 I a a a a 2 I I I I I • • • • • • I a 3 z s 4 I I I I • 0 • • • z
8H.Nil .... 15000 15000 • 10000 • 11006 • 1 .... • 106M IMM SSM
I SOot • 0 • 11000 8MM I MOO 30000
~I--4--·-11800 • • • 10000 7800
I Hot
Change the following screen to specify how to break, which request summarization, an overline and to skip a line after the subtotal.
366
Click when finished.
Let's add a grand total.
Select the Edit pull down and Summarize information At The Top .
....,T.,.:! atiLDIEII 8IIUIIIT H I .... til 5 ·-H a ·-H I • A I ..... 54 I • .. • . .... • z • 14 I ·-14 I • 18 r IHM IS r IHM H I "" " • 1-
B II • • •• • • • • • u • ..... .. • -.. - H 1 ..... N 41 I ..... --
F IS.UUII 87 , ..... II D 44 • ·-rs I ·-II 41 s -.. 4 ·-14 I 110M
H I .... II I 110M ... I IHM
8 II • • I • ' 14 • • II • ..... II • 11M - 55 I ·----
II 10.5 IS I HIM
Modify the screen to look like the following.
367
Click when finished.
Gender· or ftge of EilpJ,.... 8TftnJB EilpJ,.... DlllllREN IW.MY
33.4 62 388700 ......... ······-· . ........ F 0 29 2 8000 II 52 5 15000
" 3 15000 23 3 0 56 3 30000 54 3 0 60 3 13000 32 2 0
" 2 18000
" 2 0 38 2 10000 65 2 10000 26 I 5600 56 0 15000
s 12 0 0 16 0 0 6 0 0
22 0 13000 30 0 30000
IEP 23 1 18000 II 46 3 30000
F 35.333333 37 230100
II 0 .... 3 10000 25 2 10000
II 48 s 8000
" 4 40000
" 3 23000 28 2 12000 36 2 23000 40 2 12300
8 11 0 0 2 0 0
14 0 0 23 0 10000 33 0 raoo
IEP 55 2 12000
Let's add some final touches, including titles and headers.
368
Select the Tools pull down, Options, Report.
8Tft1118 _..,.~ Clllt.lliiEII IIMMT B2 ---··-·· ····--- ···-F p tt -II sa ·-II ISO ..
18 • 56 _ .. .. •
" ..... u • M ·-M • • ·-H ·-II -58 • 11541 .. II • • II • • • • • a • ·-'" • -BEP 18 1 .....
II ... 3 _ ..
--F as • .- ar ntltt
II D
II
8
BEP
Select Headline and Headskip.
Click when finished.
369
#IQe or 8Tft11lll &p1..,.. OIII . .IIIEN 8M.IIIIY
31.4 81 118700 ••••••••• ......... ·····-·· F D 29 2 .. oo
II S2 5 IHH n a 150H 21 a 0 ss a 10000 54 a • so a 13000 32 2 • 14 2 18000 14 2 • a8 2 10000 85 2 10000 2S 1 5600 ss 0 15000
8 12 0 0 16 0 0 s • 0
ft 0 ..... 30 0 10000
8EP 23 1 11000 N 46 3 30000
F 35.333133 17 230100
II D 44 a 10000 25 I 10000
II 48 5 MOO 34 4 40000 34 a 2aooo 18 2 11000
" 2 18000 40 2 12800
8 11 0 0 2 0 0
14 0 0 29 0 10000 33 0
Let's subset the report. Select the Subset pull down and
Click
370
8'M1U8 :y: or
&p- Dlll.lliEN M.NIY
11.1 5I a98700 ····-··· ··---- ··-····· F D H z IOtO .. 52 6 16000 H a 15000 55 a 30000 10 a 18000 34 z 11000 II z 11000 IS I 10000
" 1 5100 61 0 15000
8 zz 0 tiOOO 30 0 30000
8EP n 1 18000 N 46 a 30000
F 40.357148 11 180100
.. D 44 8 10000 15 I 10000 .. ... 5 .. .. 34 4 40000 84 a 23000 18 2 12000 31 2 21000 40 I 11300
8 II 0 10000 81 • 7UO
8EP 55 z 12000
.. 31.313136 25 161100
Lefs add a computed column to the right (very important) of the existing data. We will
add a new column called RAISE. It will use SALARY, which will be printed to the left.
SALARY must be available so RAISE can use it in a calculation.
Highlight Salary, select the Edit pull down, Add Item, Computed, Right.
371
·····--· F D ft II 5l!
" 5I .. 1M II as H Sl
8 H 80
lEI' 23 N 41
F 40.851148
II D 44 zs II •• 1M
1M Z8 as 40
8 H 38
lEI' ss II 8&.S8&36
Type in the name of RAISE.
Click to see
372
Type in the calculation.
Remember, SALARY is really known as SALARY.SUM, because the statistic has been
applied to the column on the report.
Close the window and click
Define the column as necessary.
373
Click and the following is displayed.
Gender or :y: or &pl.,..._ 8TII1UB -- at II.IIIIEN MLNIT MUlE
38.& S2 8987M IHH -······· --····· ••••••••• ···-··-F 0 29 2 8too 4M
" 52 s 15000 rse 28 a ISMO J'St SB 8 aotoo 1500 BO 8 18000 sse ... 2 180M 900 88 2 10000 soo BS 2 10000 500 H I 5&00 280 SB 0 15000 rse
8 22 0 13000 650 ao 0 3oooo 1500
8EP 23 1 18000 900 II 4& a BOOM 1500
F 40.357143 21 230&00 11580
" 0 .... a 10000 soo 25 2 10000 500
" 48 5 8000 400 34 4 400M 2000 34 a 230M II SO 28 2 12000 600 as 2 280M liSt 40 2 12300 615
8 28 0 10000 soo 33 0 7800 310
IIEP ss 2 12000 100
" 31.31363& 25 1&8100 8405
Add a title by opening up the title window.
Type liiilt!l I in the command box.
1 lhl• Ia an exa~~Pie of Prac Report 2 3 4 5 6 7 8 9
10
374
Modify as necessary and close.
Click
Gender or :y: of &pl...- 8Tt'I1U8 &p- CHILDREN IW.NIY MilE
88.8 52 398100 19985 ......... ··--···· . ........ . ........ F D 18 2 MOO 400
" 52 5 15000 7SO 28 a 15000 l'SO 58 a 80000 15t0 &0 a 18t00 ISO 84 2 18000 ... 88 2 UIOOO s .. 85 I!! 10000 5t0 28 I 5800 280 58 0 15000 rso
B 21!! 0 18000 ISO ao 0 aoooo 1SOO
8EP 28 I 18000 900 II 48 a 80000 15 ..
F 40.a57148 27 280&00 11580
" D 44 a 10000 500 25 2 10000 500
" 48 5 8000 400 84 4 40000 2000 84 8 28000 11SO 28 2 12MO 100 38 2 28000 II SO 40 2 11800 615
B 2a • 10000 500 aa 0 7800 890
8EP 55 I!! 12000 &00
" H.a&3&a& IS 188100 8405
Titles don't appear until the display is refreshed. Select the View pull down and
375
Gender or 11ge or Eloployee .8T~lU8 Eloployee atlllliiEN SM.NIY MISE
88.1 '52 818700 11185 ····-··· •........ -···-··· ······-· F 0 29 I 1000 400
" 52 15000 750 II 1&000 7&0 56 30000 1500 60 18000 6&0 34 18000 100 88 10000 500 65 10000 500 16 5600 280 58 11000 7&0
s ft I 000 650 80 30000 1500
8I!P 28 18000 900 .. 46 80000 1500
F 40.357148 2 280600 11530
" 0 44 a 10000 500 25 2 10000 500
II 48 5 8000 400 34 4 40000 2000 34 a 23000 1150 28 2 12000 600 86 2 23000 1150 40 2 12300 liS
8 23 0 10000 500 a3 0 7800 390
8I!P 55 2 12000 600
" 31.a&a6a& 25 168100 8405
Finally, let's consider how grouping is used. First, we must restructure the report.
Remove subtotaling an change all Order definitions to Group.
Highlight GENDER.
376
8TII1W :c·' &p .,._ atll.llfEN MLNIY MilE
88.8 52 898100 11185 -··-··· ·······- -···- .•....... 0 19 I 8000 400
" 51 5 15000 750 28 8 15000 750 51 8 80000 1500 50 8 18000 550 84 I 18000 900 88 I 10000 500 85 I 10000 500 as 1 5500 280 58 0 15000 750
8 II 0 18000 650 80 0 90000 1500
IEP 18 1 18000 900 II 46 8 80000 1500
40.857148 27 280600 11580
0 44 8 10000 500 25 2 10000 500
" 48 5 8000 400 84 4 40000 2000 84 a 23000 1150 28 I 12000 600 86 2 28000 1150 40 I 12800 615
8 28 0 10000 500 88 0 7800 890
IEP 55 2 12000 600
8&.81186H 25 168100 8405
Select the Edit pull down and Summarize Information,
377
Unselect summary information.
Click
While GENDER is still highlighted, select the Edit pull down and
Change the Definition to Group.
378
and see the result.
Gander of :y: of &pi- 8Tfttu8
..... _ CHII.DREN IW.NIY MISE
aa.6 5I 198700 IHH .......•• ··-····· --····· ·······-F D 29 2 8000 400 II 46.111111 21 131600 &580 s 16 0 48000 21H 8EP 23 I 18000 100 II 46 a 80000 1500
II D 34.5 5 20000 1000
" 0.6&5667 18 118800 581'5 8 28 0 17800 810 8EP &S 2 12000 600
Notice how the report can also do the summarization for us.
379
Two utilities can be useful here. We can take this report structure and output it to a SAS data set or we can simply save the code for future use.
To output the result to a data set, select the File pull down and select
To save the code created to a file, simple select on the Tools pull down and
380
Notice no Title statements are part of the code. Select the File pull down
381
and give it a name.
382