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'm using Proc Tabulate with the Out= option. In my data I keep 3 variables:

1. rule_order

2. ad_dt

3. n

 

Proc tabulate data=FinalData missing out=testdata (keep=rule_order ad_dt n) ;
class Rule_Order ad_dt;
table rule_order*(ad_dt all)*n;
run;

 

My problem is that the AD_DT's that are missing have a value of . (missing) but my totals by Rule_Order also have a . (missing). In the data I would like to be able to recode the totals that have a . to be 'Total', but I don't see a way to do this.

 

I've attached a sample of what my output dataset Testdata looks like.

 

Any help would be much appreciated.


Capture.PNG
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Look closely at the output data. You will find a variable _type_. This, similar to proc Means and Summary, indicates the combinations of variables used to create the values for a row of the data set. Determine which level(s) of _type_ represent your summary, usually not too difficult unless you have many class variables and "All" clauses.

However you are likely to have serious issues about attempting to assign a value of "Total" to a NUMERIC variable (ie you can't).

 

Depending on complexity you might get away with a custom format to assign a value of 'Total' to missing.

 

 

View solution in original post

3 REPLIES 3
Astounding
PROC Star

By default, PROC TABULATE omits observations where any CLASS variable has a missing value.  You can have them included by adding the MISSING option.

Reeza
Super User
class Rule_Order ad_dt /Missing ;

 

ballardw
Super User

Look closely at the output data. You will find a variable _type_. This, similar to proc Means and Summary, indicates the combinations of variables used to create the values for a row of the data set. Determine which level(s) of _type_ represent your summary, usually not too difficult unless you have many class variables and "All" clauses.

However you are likely to have serious issues about attempting to assign a value of "Total" to a NUMERIC variable (ie you can't).

 

Depending on complexity you might get away with a custom format to assign a value of 'Total' to missing.

 

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1761 views
  • 1 like
  • 4 in conversation