BookmarkSubscribeRSS Feed
BillB007
Obsidian | Level 7

The code below produces a report my customer wants EXCEPT that the bottom row, which is a total of all the values above it, is right justified and all the other cells are center justified.   They object to that.  The bottom row is also colored differently by design.    I know this is probably a simple fix but i've put 'just=R' everyplace I can think of and just can't get it to justify that bottom row.    Any ideas??  I had to add the Total=R on the label line to get the label to be right justified which it needs to be.  I suspect that is causing everything on that row to be that way.   So maybe another way of stating the problem is how can I get ONLY the label to be right justified and the values to be centered?

 

---------------------  code  ----------------------------

proc tabulate data =&input f=4.0 S=[just=c cellwidth=25]; 
var Col1;
class criterion instrument /ORDER=DATA ;
class _name_ ;
table instrument*criterion all={label='Total' s=[just=R background=goldenrod]}*{s=[background=goldenrod]} ,(_name_='Level' ALL)*Col1=" "*(sum="N"*(f=3.0) ROWPCTSUM="%"*f=mypct. ) /box=&reportdate; 
BY instrument NOTSORTED; 
run;

 

 

3 REPLIES 3
ballardw
Super User

When a single row needs a different appearance then that may mean that Proc Report is a better option as it allows a separate define block for breaking rows, which I think is what you are attempting. Unfortunately if you have nearly working Tabulate code there is not an easy translation to Report and statistic calculations are done quite differently for percentages.

BillB007
Obsidian | Level 7

Thanks but I don't want the row to have a different justification, I want all the rows to have same justification.   The problem I'm having is that the last row is NOT like the others.  I'd be happy if they were all left, right or center justified (we prefer centered) but the body of the report is center justified and the total row at the bottom is right justified.   I personally don't care but my university client think it looks sloppy and can't believe it can't be fixed since they can make it look right when they do it in Excel!  🙂   I'm doing this to automate the production of hundreds of reports which they currently manually create in Excel.

 

You are correct that at this point, we've done too much work to change to a different report writer.   I used Proc Tabulate so it would be compatible with other reports they already use it for so  whoever is going to maintain this will have the same report Proc for everything.  Everything is fine except that last row justification problem.

 

 

Bill

 

ballardw
Super User

Your code says to use two different justifications. The S=[just=C cellwidth=25] on the proc statement sets a default and then you have Just=R for the ALL. Which is why I thought you were attempting two different behaviors.

 

It would help to provide some data to test code with, dummy is fine as long as it behaves the same.

 

It will also help to provide which ODS destination you are using and the ODS style you are using. 

When I use a different data set with similar tabulate code with HTML destination and Meadow style the Total row label is right justified with the colored background and all of the summary cells centered.

 

 

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