Hi. I have some output that doesn't quite match my requirements. In the Proc Summary below I need to add some missing components:
1. a total count of all AD_DTs for each Rule_Order
2. AD_DT's should display in a MM/DD/YYY format
Sample data attached.
Any help would be greatly appreciated.
PROC SUMMARY data=FinalData print;
CLASS rule_order ad_dt;
run;
The SUMMARY Procedure
RULE_ORDER AD_DT N Obs
-----------------------------------------
1 14MAR16:00:00:00 5
15MAR16:00:00:00 3
16MAR16:00:00:00 14
17MAR16:00:00:00 13
18MAR16:00:00:00 20
19MAR16:00:00:00 19
22MAR16:00:00:00 4
25MAR16:00:00:00 2
1.5 15MAR16:00:00:00 1
17MAR16:00:00:00 1
18MAR16:00:00:00 2
19MAR16:00:00:00 6
21MAR16:00:00:00 12
22MAR16:00:00:00 4
23MAR16:00:00:00 7
24MAR16:00:00:00 18
25MAR16:00:00:00 110
-----------------------------------------
Since your current data apparently is a datetime you could change the value to be a date in a data step using:
data want;
set FinalData;
at_dt = datepart(at_dt);
format at_dt mmddyy10.;
run;
If you use an output statement to generate an output data set it will contain several combinations of the class variables.
But it sounds like you may want a report procedure:
Proc tabulate data=want;
class Rule_Order ad_dt;
table rule_order*(ad_dt all)*n;
run;
Can you provide sample data. In a problem like this it's important to replicate the issues you're having.
Sample data attached. Thanks.
Since your current data apparently is a datetime you could change the value to be a date in a data step using:
data want;
set FinalData;
at_dt = datepart(at_dt);
format at_dt mmddyy10.;
run;
If you use an output statement to generate an output data set it will contain several combinations of the class variables.
But it sounds like you may want a report procedure:
Proc tabulate data=want;
class Rule_Order ad_dt;
table rule_order*(ad_dt all)*n;
run;
Thanks. The format doesn't seem to take affect in the Proc Summary or Proc Tabulate, I'm not sure why? Do I have to indicate that I want the format used in the Proc?
I see that the Proc Tabulate is much closer to what I want, but it doesn't seem to have a total for Missing Values. Can I add something for this?
/Missing in Class statement
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.