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.
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.
By default, PROC TABULATE omits observations where any CLASS variable has a missing value. You can have them included by adding the MISSING option.
class Rule_Order ad_dt /Missing ;
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.
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!
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.