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 now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.