BookmarkSubscribeRSS Feed
bob021
Calcite | Level 5
Hi
Can somebody help me with this.
Data:
Name operations next actiondate
Bob A sent 11.Jan.2011
John A sent 11.Jan.2011
Bob A sent 11.Jan.2011
John A sent 11.Jan.2011
John A sent 11.Jan.2011
Bob A sent 12.Jan.2011
John A sent 12.Jan.2011
Bob A sent 12.Jan.2011
John A sent 12.Jan.2011
Bob B fail 11.Jan.2011
John B fail 11.Jan.2011
Bob B pass 11.Jan.2011
John B wait 11.Jan.2011
John B pass 11.Jan.2011
Bob B fail 12.Jan.2011
John B fail 12.Jan.2011
Bob B pass 12.Jan.2011
John B pass 12.Jan.2011


Sas statement:
proc tabulate data=SVBZ01A0.user_end_debug;
keylabel n = ' ';
class name operations next actiondate;
table name='' * operations='' * next='', actiondate='' all='Total'

/ misstext='0';
run;

Result is table:
First column name; second is split into two rows operations A and B; Third: A is always sent and B is split into fail/pass/wait; all by date

What I want is to make new column percentage for fail/pass/wait of SENT for every day:

Bob sent(A) 2 pc 11.Jan.2011 one is fail one is pass(B). In new colum should be fail 50% and pass 50%

John sent(A) 3 pc 11.Jan.2011 one is fail,one is pass and one is wait(B) In new colum should be fail 33,3%, pass 33,3% and wait 33,3%

Thak you in advance.
5 REPLIES 5
deleted_user
Not applicable
Hello,

From your details I understand that Sum of B (fail, pass, wait) equal A (sent).
if my assumption is correct then a little rearrangement of your tabulate may be more appropriate:



[pre]
Data x;
input Name $ operations $ next $ actiondate date11.;
format actiondate date7.;
datalines;
Bob A sent 11.Jan.2011
John A sent 11.Jan.2011
Bob A sent 11.Jan.2011
John A sent 11.Jan.2011
John A sent 11.Jan.2011
Bob A sent 12.Jan.2011
John A sent 12.Jan.2011
Bob A sent 12.Jan.2011
John A sent 12.Jan.2011
Bob B fail 11.Jan.2011
John B fail 11.Jan.2011
Bob B pass 11.Jan.2011
John B wait 11.Jan.2011
John B pass 11.Jan.2011
Bob B fail 12.Jan.2011
John B fail 12.Jan.2011
Bob B pass 12.Jan.2011
John B pass 12.Jan.2011
;
proc tabulate data=x format=8.1;
keylabel n = 'Total';

class name next operations actiondate;

table name=''* actiondate='',
(next=''*rowpctn='Percent') all='Sent'*format=5.*{style={color=red fontweight=bold}}

/ misstext='0' box={label='My Table represents...' Style={backgroundcolor=yellow}} ;

where next ne 'sent';
run;
[/pre]

Marius

bob021
Calcite | Level 5
Hello Marius
Thank you very much working like a charm.
Bob
bob021
Calcite | Level 5
Hi Marius
One more thing about this solution.
Is it possible to change place of actiondate and next? I mean to have on left side name next and percent and on top actiondate.
Thank you in advance
deleted_user
Not applicable
hello Bob,

here is a soltuion with denominator:

[pre]
proc tabulate data=x format=8.1 ;
keylabel n = 'Total';

class name next operations actiondate;

table name=''* (next=''*pctn='Percent' all='Sent'*format=5.*{style={color=red fontweight=bold}}),
actiondate=''

/ misstext='0' box={label='My Table represents...' Style={backgroundcolor=yellow}} ;

where next ne 'sent';
run;
[/pre]

HTH,
Marius
bob021
Calcite | Level 5
Hello Marius
Thank you very much.
Bob

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1539 views
  • 0 likes
  • 2 in conversation