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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.