The SAS Output Delivery System and reporting techniques

Proc Report Total Line

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 148
Accepted Solution

Proc Report Total Line

Hi all,

 

Could you please help to code the line before Total as it is can be seen below.

1.jpg

 

Thank you!


Accepted Solutions
Solution
‎10-30-2017 05:43 AM
Frequent Contributor
Posts: 148

Re: Proc Report Total Line

Posted in reply to Cynthia_sas

The case was resolved by adding the following data to var3:

 

 var3 = "(*ESC*)S={bordertopwidth=1}"||"             Total # of Subjects Attended Visit = " || strip(put(number, 8.));

View solution in original post


All Replies
Super User
Posts: 10,194

Re: Proc Report Total Line

Posted in reply to DmytroYermak
Use original code of RTF.

ods escapechar="^";
proc report...;
  columns x ("^R'\brdrb\brdrs\brdrw15 'Powers" y z) ;


Frequent Contributor
Posts: 148

Re: Proc Report Total Line

[ Edited ]

I bring my apologies for misunderstanding but the line appeared in the Header. I actually need in it in the column itself, just above the text: Total # of Subjects Attended Visit = XXX

 

1.jpg

 

 

The case is deepen by fact that the line "Total # ... etc." is a character value in the column.

 

I am thinking about using the block 'compute before'.

 

How could it be written:

 

compute before var3;
  if var3='Total ...' then
   line "---------------- ";
endcomp;

? Could you please correct the code? Mine is definitely is not working )... (

 

 

 

SAS Super FREQ
Posts: 8,951

Re: Proc Report Total Line

[ Edited ]
Posted in reply to DmytroYermak

Hi:
It is really hard to do what you ask with code or data to test. It is impossible to "correct" your COMPUTE block out of context -- it needs the whole code and some data.

If you can't share your data then make some fake data or use one of the SASHELP datasets. I do not think your COMPUTE before will do what you want, because you would be writing the line at the TOP of the group when VAR3 changes. According to your picture, that is not where you want the LINE to be written.

 

Another reason why it is important to see all the code is that in your screen shot, it doesn't look like there's a column for VAR3, which implies that it might be a NOPRINT item. And, depending on the order of variables in the COLUMN statement, you might be testing VAR3 at the wrong place.

cynthia

Solution
‎10-30-2017 05:43 AM
Frequent Contributor
Posts: 148

Re: Proc Report Total Line

Posted in reply to Cynthia_sas

The case was resolved by adding the following data to var3:

 

 var3 = "(*ESC*)S={bordertopwidth=1}"||"             Total # of Subjects Attended Visit = " || strip(put(number, 8.));
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 248 views
  • 0 likes
  • 3 in conversation