BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
buechler66
Barite | Level 11

 

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
                                           -----------------------------------------

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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;

View solution in original post

5 REPLIES 5
Reeza
Super User

Can you provide sample data. In a problem like this it's important to replicate the issues you're having. 

 

buechler66
Barite | Level 11

Sample data attached.  Thanks.

ballardw
Super User

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;

buechler66
Barite | Level 11

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?

 

 

Reeza
Super User

/Missing in Class statement

SAS Innovate 2025: Register Now

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!

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
  • 1718 views
  • 0 likes
  • 3 in conversation