BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kelsey_SAS
Calcite | Level 5

I'm struggling with PROC REPORT on my break statements.  I have a couple of columns that are numerical and should be right justified--and in the main output table it right justifies correctly.  However, I have a couple of break after statements that are summarizing the numbers, and for some reason they left justify by default.  I could add style(summary)={just=right}, but then it also right justifies the categorical columns, which should be left justified.  Anyone know a way to left justify some columns and right justify others?  I've tried a million different ways and nothing seems to work.  Thank you.

data test ;
infile datalines truncover;
input cust_order:$356. pledge_order:$25. bbcrm_pledge_id: $100. open_amount_rem:8. past_due_amount_rem:8.;
datalines;
Bread REV-123456 REV-123456 25 75
Bread REV-123456 REV-123456 35 65
Bread REV-123456 REV-123456 100 0
Bacon REV-234567 REV-234567 200 0
Bacon REV-234567 REV-234567 100 100
Bacon REV-234567 REV-234567 150 0
Coffee REV-345678 REV-345678 100 25
Coffee REV-345678 REV-345678 60 140
Coffee REV-345678 REV-345678 50 50
;
run;


proc report data=test spanrows
style(report)=[bordercolor=black borderwidth=3 just=right]
style(header)=[foreground=black background=light grey font_weight=bold bordercolor=black borderwidth=3 just=R]
style(summary)=[background=light grey font_weight=bold just=l bordertopcolor=black bordertopwidth=3 borderbottomcolor=black borderbottomwidth=3];
columns
cust_order
pledge_order
bbcrm_pledge_id
open_amount_rem
past_due_amount_rem
;
define pledge_order/order style(column)={just=r} noprint;
define cust_order/order style(column)={just=r} noprint;
define bbcrm_pledge_id/display style(column)=[borderleftcolor=black borderleftwidth=3 just=L];
break after cust_order /summarize dol dul style(summary)=[background=cxE4DFEC];
break after pledge_order /summarize dol dul style(summary)=[background=cxFCD5B4 ];
rbreak after/summarize ;
compute after cust_order;
bbcrm_pledge_id= 'Total '||trim(cust_order);
endcomp;
compute after pledge_order;
bbcrm_pledge_id= 'Total '||pledge_order;
endcomp;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Please be very explicit in describing which columns or cells you need to be right and left justified. Currently the only thing you attempt to justify right has the NOPRINT property so it doesn't appear in the result.

 

If you mean that you want the numeric values in the summary lines to be right justified then remove the JUST=L that you have in:

style(summary)=[background=light grey font_weight=bold just=l bordertopcolor=black bordertopwidth=3 borderbottomcolor=black borderbottomwidth=3];

because that says everything in the summary is to be left justified.

 

Since character values by default will be left justified and numeric right justified that seems like what you may want.

 

 

You may find that the (column) and (summary) in the style defines for the DEFINE statements aren't needed and I suspect are not used as Define is more of a cell behavior control, just all of the cells of like type so they appear to be column or summary.

View solution in original post

3 REPLIES 3
Community_Guide
SAS Moderator

Hello @Kelsey_SAS,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @ballardw

.
ballardw
Super User

Please be very explicit in describing which columns or cells you need to be right and left justified. Currently the only thing you attempt to justify right has the NOPRINT property so it doesn't appear in the result.

 

If you mean that you want the numeric values in the summary lines to be right justified then remove the JUST=L that you have in:

style(summary)=[background=light grey font_weight=bold just=l bordertopcolor=black bordertopwidth=3 borderbottomcolor=black borderbottomwidth=3];

because that says everything in the summary is to be left justified.

 

Since character values by default will be left justified and numeric right justified that seems like what you may want.

 

 

You may find that the (column) and (summary) in the style defines for the DEFINE statements aren't needed and I suspect are not used as Define is more of a cell behavior control, just all of the cells of like type so they appear to be column or summary.

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
  • 4957 views
  • 1 like
  • 3 in conversation