BookmarkSubscribeRSS Feed
ANKH1
Pyrite | Level 9

Hi, I am trying to use proc report to format a table. This is the code I am working with:

 

proc report data=final;
  column visitn("^R'\brdrb\brdrs\brdw1'cohort'" visit)
....
;
run;

The problem is that "cohort" is not a variable is just a title that goes above the variable visit. How can "cohort" be justified to the left instead of center? This is what it should look like:

cohort
visit
baseline
month 6
month 12
month 18

Note that this is only a part of the bigger table, but those columns are ok.

4 REPLIES 4
PaigeMiller
Diamond | Level 26

You can use what SAS calls the ESCAPECHAR to provide formatting information. An example of center justifying text is shown on page 4 of this document: https://support.sas.com/resources/papers/proceedings10/215-2010.pdf

 

Since you want left justified, instead of JUST=C in that example, you would use ___________ (fill in the blank).

--
Paige Miller
ANKH1
Pyrite | Level 9

Thanks for your response and sharing the document. But I am not sure how to apply that to the code provided, since this string title is embedded in the table and in proc report? How can ^ be incorporated? I have it already before proc report where I add the title and footnotes of the table.

Cynthia_sas
SAS Super FREQ

Hi:

  I don't think the RTF control strings will work for you. However, the simple style overrides should work, as shown in these 3 examples. Note that I made example 3 quite extreme and did the Header cells and the Data cells all with different justifications:

Cynthia_sas_0-1695741741020.png

  Hope this helps,

Cynthia

ANKH1
Pyrite | Level 9

Thank so you much Cynthia! Your examples are really helpful and I am learning a bit more about formatting with proc report.  It worked but all the titles that do not come from variables, are justified to the left. The only column that it is needed to the justified is the first one. When I add in the style just=l, cohort and measures are both justified to the left. This is a sample of how the table should look like:

SanKH1_1-1695743469842.png

Thank you!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 787 views
  • 1 like
  • 3 in conversation