BookmarkSubscribeRSS Feed
csetzkorn
Lapis Lazuli | Level 10

I am using this:

 

 

proc tabulate data=SomeData;
	class Class1 Class2;
	table Class1, Class2;
run;

which shows N for each cell in this 2 dimensional scenario. How can I add a row percentage please? I tried:

 

proc tabulate data=SomeData;
	class Class1 Class2;
	table Class1*ROWPCTSUM, Class2;
run;

 

4 REPLIES 4
Astounding
PROC Star

Since you have only classification variables, and no analysis variables, there is no way to calculate PCTSUM.  You could switch to PCTN instead, if that's what you want (or ROWPCTN).  But to get the sum of something, SAS needs to know what variable you want to sum.

csetzkorn
Lapis Lazuli | Level 10
Thanks this contradicts the book: PROC TABULATE by Example, Second Edition but maybe the book is wrong ...
ballardw
Super User

@csetzkorn wrote:
Thanks this contradicts the book: PROC TABULATE by Example, Second Edition but maybe the book is wrong ...

Please copy the text you are referencing to the forum. The book has a LOT of examples and many of them involve percentages in one form or another. It is hard to comment on something unseen...

 

 

PaigeMiller
Diamond | Level 26

A "thinking out of the box" reply

 

There are a number of concepts that I find difficult or confusing in PROC TABULATE, including all the percent options, but are very easy to get right in a data step of some sort. So my usual method is to get all the rows and columns to look the way I want in a data step (often using PROC SUMMARY), and then use PROC REPORT or even PROC PRINT to create the final table.

--
Paige Miller

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

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
  • 4 replies
  • 1301 views
  • 0 likes
  • 4 in conversation