Help using Base SAS procedures

one question about layout

New Contributor
Posts: 2

one question about layout

Hi, everyone.

The table below is the sample that I want my output looks like, please notice the percentages have extra space so the numbers and percents all line up nicely and right-aligned. Is there a way to update the  layout so it looks like this?Thanks.

   xxxx     n (   4.9%)          n ( 7.0%)       nn ( 5.9%)

   xxxx     n (   0.0%)          n ( 0.0%)         n ( 0.0%)

   xxxx   nn (24.6%)         nn (21.7%)       nn(23.2%)

   xxxx    nn (100%)         nn ( 100%)       nn ( 100%)

Super User
Posts: 13,583

Re: one question about layout

How are you creating the output? Methods can make a difference as well as fonts used by any current style. If you read your post, which the formum may have turned a monospace font into proportional, your parantheses and percents do not line up well.

New Contributor
Posts: 2

Re: one question about layout

I am sorry my post does not look well. (I tried to attach a file, but failed. )

The parantheses and percents should line up well. The contents inside of the parantheses have a fixed length and right-aligned too. nn and n also right-aligned. There has one space between nn/n and the parantheses.

Posts: 9,371

Re: one question about layout


  The fact is that SAS, by default, will not "like" to put 2 numbers (like N and PCTN) into 1 cell with punctuation (parentheses and %). So usually, when you do a report like this you are capturing the N and the PCTN by creating an output dataset and then you concatenate the 2 numbers together into a character string with the appropriate punctuation and then you use PROC PRINT or PROC REPORT or the DATA step to display the numbers.

  I have 3 different examples of creating a report similar to this in my "Creating Complex Reports" paper. You can find the paper by searching on or in the forum for previous postings of the link.

There are a couple of other things that you could do, too. The bottom line is that, as BallardW pointed out, depending on the ODS destination you choose, the spacing may be problematic, since only the LISTING (monospace) destination will "line up" the way you want.


Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation