BookmarkSubscribeRSS Feed
tzaman
Calcite | Level 5

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;

3 REPLIES 3
Reeza
Super User

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.

Astounding
PROC Star

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;

ballardw
Super User

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-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 921 views
  • 1 like
  • 4 in conversation