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
SAS Super FREQ
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

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
  • 841 views
  • 0 likes
  • 3 in conversation