How do I include a variable in the proc tabulate table statment and have the output simply print the values of the variable instead of computing a statistic on version 9.4? Right now, I am getting a sum of the diff variable for each month since it's the default.
proc tabulate data=weather;
class precip month;
var temp diff;
table month*precip,temp*(max) diff;
run;
Please show some more details of what you may be looking for, it may be better to use PROC REPORT in this case, if no statistics are to be calculated.
It's very difficult to picture how your report would make any sense. Is DIFF constant for an entire month? If that's the case, here are some ideas you can play with to see if they come closer to what you are looking for:
tables month*precip, temp*max diff*mean;
or
tables month, precip*temp*max diff*mean;
Do you have the same value of DIFF for all records within a month*precip combination (and I won't really mention how odd it looks to see Precip which I would almost always see as a var variable in any of my data used as a class variable). If so perhaps DIFF should be a class variable on the row dimension.
A very good idea when dealing with data dependent questions is to post an example input data set to show us what you have and then show what the desired result for that example data should be. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.
In some very specific cases I have gotten an appearance similar to what you are requesting by using a statististic with variables in the role of your Diff but that was because I knew I was going to use tabulate to display the values and the data was structured to work with Proc Tabulate rules [In my case only one record per combination of the row class values had non-missing value for the variable in question]. Max or Min would be likely candidate statistics.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.