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 2024

Innovate_SAS_Blue.png

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. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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