BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am trying to create a table that has the "n" and "%" in separate rows, so that the percentages can be read from the table straight across, instead of having the "n" and "%" columns next to each other. Here is my current code - any ideas? Thanks in advance! (Q1 is a 1-5 scale.)

proc tabulate data=mvr.ready_08_6Jun(where=(wave ge 230)) format=9.1 noseps formchar(1,8,2,3,4,5,6,7,9,10,11)='||----|+|---';
title 'Table 1a';
format wave wave. q1 sat. total total.;
class wave q1 total;
table (q1="OVERALL SATISFACTION" total=' '),
wave*(pctn*f=p8r6.0 N*f=4.0)/rts = 35
box="Table 1a. OVERALL SATISFACTION" misstext=' ';
keylabel pctn = "(%)";
run;
2 REPLIES 2
Olivier
Pyrite | Level 9
Hello.

In your example, what you need to do is move the *(PCTN ... F=4.0) part BEFORE the comma, meaning that you want separate LINES instead of COLUMNS (what is after comma defines columns).
I've tested this little code, slightly different from yours, but showing the idea.
[pre]
PROC TABULATE DATA=sashelp.prdsale ;
CLASS region product year ;
VAR actual ;
TABLE (region product)*(SUM="N"*F=12. PCTSUM="%"*F=12.2),
actual=""*year="" ;
RUN ;
[/pre]
Regards,
Olivier
deleted_user
Not applicable
Thank you so much, Olivier! That is exactly what I needed to know!

sas-innovate-2024.png

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.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 620 views
  • 0 likes
  • 2 in conversation