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
Opal | Level 21

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

innovate-wordmarks-white-horiz.png

SAS is headed back to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team.

Interested in speaking? Content from our attendees is one of the reasons that makes SAS Innovate such a special event!

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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