BookmarkSubscribeRSS Feed
Jackie_Stanbank
Calcite | Level 5
i have a tabulate with below output. i want the numbers to be represented as a percentage of "All". is there an easier way to do this apart from a proc summary and merge?
| Broken | Kept | |
| |------------------------------------+-----------------------------------| |
| | No_Pmt | Part_Pmt | Full_Pmt | Over_Pmt | All |
| |-----------------+----------------+----------------+-----------------+------------|
| | N | N | N | N | N |
|-----------------------------+----------------+---------------+----------------+-----------------+-------------|
|Agent | | | | | |
|-----------------------------| | | | | |
|1401 | 1.00| .| .| .| 1.00|
|-----------------------------+----------------+---------------+----------------+-----------------+-------------|
|1423 | 2.00| .| .| .| 2.00|
----------------------------------------------------------------------------------------------------------------------
5 REPLIES 5
Peter_C
Rhodochrosite | Level 12
probably.
what code do you have so far?
it only needs a small variation, I expect
Peter_C
Rhodochrosite | Level 12
ok here is a small attempt to demo.
Not knowing what is really wanted, and how the underlying data are structured, it probably does not hit the mark, but might give an idea
data peterC ;
input agent $ type $ amount ;
list;cards;
1401 npmt .
1401 part 123
1401 over 256
1423 npmt .
1423 npmt .
1423 full 999
1423 part 100
1423 part 115
;
proc tabulate missing formchar='|----|+|---';
class agent type ;
var amount ;
title 'payment type distribution' ;
table agent all, type=' '*pctN='%' *f= 6.1 all*N*f= 5./rts=11 box=' per-cent by number';
table agent all, type=' '*amount=' ' *pctsum='%' *f= 6.1 all*amount*sum=' '*f= 8./rts=11 box=' per-cent by value';
run;[pre]payment type distribution 16:20 Monday, January 10, 2011 1

---------------------------------------------
| | full | npmt | over | part | All |
|per-cent |------+------+------+------+-----|
|by number| % | % | % | % | N |
|---------+------+------+------+------+-----|
|agent | | | | | |
|---------| | | | | |
|1401 | .| 33.3| 33.3| 33.3| 3|
|---------+------+------+------+------+-----|
|1423 | 20.0| 40.0| .| 40.0| 5|
|---------+------+------+------+------+-----|
|All | 12.5| 37.5| 12.5| 37.5| 8|
---------------------------------------------


payment type distribution 16:20 Monday, January 10, 2011 2

------------------------------------------------
| | full | npmt | over | part | All |
|per-cent |------+------+------+------+--------|
|by value | % | % | % | % | amount |
|---------+------+------+------+------+--------|
|agent | | | | | |
|---------| | | | | |
|1401 | .| .| 67.5| 32.5| 379|
|---------+------+------+------+------+--------|
|1423 | 82.3| .| .| 17.7| 1214|
|---------+------+------+------+------+--------|
|All | 62.7| .| 16.1| 21.2| 1593|
------------------------------------------------
[/pre] and recommend the [ pre ] signals to present results in a fixed pitch for ordinary listing of tables or columns. The best place to find this is at http://support.sas.com/forums/thread.jspa?messageID=27609毙

peterC
Cynthia_sas
SAS Super FREQ
Hi:
PROC TABULATE has more percent statistics than any other procedure, starting with PCTN (percent of the overall count (or N), ROWPCTN, COLPCTN, PAGEPCTN and REPPCTN. If you want the percent of a numeric variable (not just the count), then the "SUM" version of the percent statistics: PCTSUM, ROWPCTSUM, COLPCTSUM, PAGEPCTSUM and REPPCTSUM get called into action.

As Peter said -- it is probably a simple change to the code you already have.

cynthia
Jackie_Stanbank
Calcite | Level 5
thanx for the feedback. i will try and apply the suggested code.
FYI my code is as follows (with count only):

proc tabulate data= vaf_ptps_pmts3 out= vaf_ptps_pmts4;
class adj result pmt_status;
var ptp_cnt;

table adj ={label='Agent' s=[background=very dark blue foreground=white]},
result ={label=' ' s=[background=very dark blue foreground=white]}*
pmt_status ={label=' ' s=[background=very dark blue foreground=white]}
all;
where month = 'Dec-10';
run;
Peter_C
Rhodochrosite | Level 12
so that suggests a table statement like
table adj ={label='Agent' s=[background=very dark blue foreground=white]},
result ={label=' ' s=[background=very dark blue foreground=white]}*
pmt_status ={label=' ' s=[background=very dark blue foreground=white]} * pctn='%'
all *N ;

or RowPctN instead of result*pmt_status as denominator definition (since SAS91 has made that so much simpler when the table structure permits) since I cannot test on your data structure, I decided to offer the simpler alternative denominator definition ROWpctN
Message was edited by: Peter.C

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1464 views
  • 0 likes
  • 3 in conversation