BookmarkSubscribeRSS Feed
TreeFrog
Calcite | Level 5
Hi y'all

I'm in ods pdf, proc-report-ing, and I'm wanting to justify the first part of a line (a string) left, and the last part right.

Something like
proc report
data whatever;
columns ("^S={just=L}This part left^S={just=R}this part right" col1 col2 col3);


...I can't do this, can I? (sinking feeling)

Thanks

Tree Frog
3 REPLIES 3
Cynthia_sas
Diamond | Level 26
Hi:
See if this does the trick for you WITHOUT using ODS ESCAPECHAR. PROC REPORT gives you a way to produce "spanning headers" by just specifying the string you want BEFORE the variables you want the string to span. Try this code. I've included the LISTING dest version, as well, so you can see how it started:[pre]
ods listing close;
ods pdf file='c:\temp\spanhead.pdf';
proc report data=sashelp.shoes(obs=20) nowd;
column ('Something' region subsidiary) ('Something Else' product sales inventory);
run;
ods pdf close;

ods listing;
proc report data=sashelp.shoes(obs=20) nowd;
column ('-Something-' region subsidiary) ('-Something Else-' product sales inventory);
run;
[/pre]

I think this is close to what you want.
cynthia
ScottH_SAS
SAS Employee
After chatting with the Proc Report developer we found out that if you use two strings in the column statement you will get something that might be what you want.

Cynthia's is on one line while this one is on two lines.

Let us know!
Scott

ods pdf file = "test2.pdf";
ods escapechar = "^";
options orientation=landscape;
proc report data=sashelp.class nowd;
col ("^S={just=L}This part left" "^S={just=R}this part right" name sex age height weight);
define name--weight / display;
run;
ods pdf close;
TreeFrog
Calcite | Level 5
Thanks - getting very close here, I think.

Cynthia's suggestion does what I'm after, but I'm hoping to apply that second approach (two separate strings enclosed in separate quotes) for some LINEs later in the report.

However, the 'just=' in-line style declaration doesn't seem to have any effect.

Try putting

compute after;
line "^S={just=L}This bit left" "^S={just=R}This bit right";
endcomp;

in a proc report step... or am I missing something?

TF

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1357 views
  • 0 likes
  • 3 in conversation