DATA Step, Macro, Functions and more

proc report not able to sum up

Accepted Solution Solved
Reply
Regular Contributor
Posts: 214
Accepted Solution

proc report not able to sum up

Hi,

 

I am summing up *N* in my define statement but it does not work. attached the code and sample data.

options missing = "" ls=200;
proc report data = DESC2_CAT030 nowd split = "¤" headline missing contents = "" out=DESC2_CAT030_rpt;
column param=BV actarm=AV timevar = TV filler bnrind=A2N ('  ' count=BN) anrind, ( count pctc ) dummy ;
define param / group style(header)={just=left cellwidth=4.5cm} style(column)=IdColIndent2{asis=on} "" ;
define actarm / group style(header)={just=left cellwidth=2cm} style(column)=IdColIndent2{asis=on} "Treatment Group";
define timevar /group style={just=right cellwidth=2cm} "Week" ;
define bnrind / display style={just=left cellwidth=2.1cm} "Baseline Reference Range Indicator";
define A2N /group order=data style={just=left cellwidth=2.1cm} "Baseline Reference Range Indicator";
define filler /display style={just=left cellwidth=0.2cm} "";
define anrind /across order=data style={just=left} "Analysis Reference Range Indicator";
define dummy /computed noprint;

define BN / analysis sum "    N" style={just=right cellwidth=1.47499999999998cm} ;
define count /analysis sum style={just=right cellwidth=1.47499999999998cm} "n";
define pctc /display style={just=right cellwidth=1.96666666666664cm} "(%)";
define BV /group style={just=right cellwidth=4.5cm} "";
define TV /group style={just=right cellwidth=2cm} "Week";
define AV /group style={just=right cellwidth=2cm} "Treatment Group";

compute before;
line @1 ' ';
Total=BN;
endcomp;

compute after timevar;
TV=' ';
AV=' ';
BV=' ';
A2N='N';
line ' ';
endcomp;

break after timevar / summarize;

run;

while running the report i get multiple observations of N.

 

Attachment

Accepted Solutions
Solution
‎01-17-2018 04:15 AM
SAS Super FREQ
Posts: 830

Re: proc report not able to sum up

You still have a DISPLAY variable, so this is why you get individual lines. Check the log for "Groups are not created"

 

 

Define the filler var as

define filler /group style={just=left cellwidth=0.2cm} "";

and you should be ok

 

 

View solution in original post


All Replies
Solution
‎01-17-2018 04:15 AM
SAS Super FREQ
Posts: 830

Re: proc report not able to sum up

You still have a DISPLAY variable, so this is why you get individual lines. Check the log for "Groups are not created"

 

 

Define the filler var as

define filler /group style={just=left cellwidth=0.2cm} "";

and you should be ok

 

 

Super User
Super User
Posts: 9,840

Re: proc report not able to sum up

I am sure we have been over these things before.  Do calculations in a datastep before the proc report, whilst report can do some basic stuff its really not a data processing procedure.  There are a lot of oddities in what you have posted here, so I won't bother looking at it.  What I would suggest is your post, in a datastep using the code window (not attached files), a small sample of test data (I would avoid using actual data).  Then show what it is you would like to see at the end, I suspect a simple transpose procedure and then datastep would get what you want but as I don't the output I can't do it.

SAS Super FREQ
Posts: 830

Re: proc report not able to sum up

Also check this two statements:

  define bnrind / display style={just=left cellwidth=2.1cm} "Baseline Reference Range Indicator";
  define A2N /group order=data style={just=left cellwidth=2.1cm} "Baseline Reference Range Indicator";

you only need the A2N, as this us used in the COLUMN statement

☑ This topic is solved.

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

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