BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7
Original Data        
  LOB MEMBER COUNT  PROGRAM  NAME PAID 
  MEDICAID 150 A $300
    290 B $600
    100 C $760
  MEDICARE 400 A $1,000
    350 B $400
    180 C $350

 

Want output report like this:

REPORT FORMAT         
SUMMARY BY LOB LOB MEMBER COUNT  PROGRAM  NAME PAID 
  MEDICAID 150 A $300
    290 B $600
    100 C $760
  TOTAL 540    
  MEDICARE 400 A $1,000
    350 B $400
    180 C $350
  TOTAL 930    

 

do not  know how to 

1 ACCEPTED SOLUTION

Accepted Solutions
tarheel13
Rhodochrosite | Level 12

Please follow what @Reeza said. If you change paid to 'display' in my code, then it will give you what you wanted and yes, you should post code with the running man icon in your posts. It is rather hard to read the way you posted it.

View solution in original post

12 REPLIES 12
Reeza
Super User
Please show your current code.
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7
PROC REPORT  DATA=DATA_SAMPLE    
  COLUMNS MEMBER COUNT  PROGRAM  NAME PAID ;
  DEFINE TOTAL/COMPUTED;    
  DEFINE LOB/ORDER;    
  BREAK AFTER LOB/SUMMARIZED SUPPRESS;  
  COMPUTE BEFORE LOB;    
  TOB="TOTAL";      
  TOTAL=SUM(MEMBER_COUNT);    
  ENDCOMP;      
RUN;        
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

LOB="TOTAL"

tarheel13
Rhodochrosite | Level 12
data test;
input LOB $ count prog $ paid;
datalines;
MEDICAID 150 A 300
MEDICAID 290 B 600
MEDICAID 190 C 760
MEDICARE 400 A 1000
MEDICARE 350 B 400
MEDICARE 180 C 350
;
run;

proc report data=test split='*';
	columns LOB count prog paid;
	define LOB / ' *LOB' order order=internal;
	define count / analysis 'Member*Count';
	define paid / ' *Paid';
	define prog / "Program*Name";
	break after LOB / summarize;
	compute after LOB;
		LOB='Total';
	endcomp;
run;
	
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

thank you, after run , the result. 

LOB MEMBERCOUNT  PROGRAMNAME PAID 
MEDICAID 150 A $300
  290 B $600
  100 C $760
TOTAL 540   $1,660
MEDICARE 400 A $1,000
  350 B $400
  180 C $350
TOTAL 930   $1,750

I do not want  paid summary or computers, want remove  $1,660, %1,750   and become blank , only memer_count need summarized and leave the rest of are blank 

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

$1,660, $1,750 no needed, want to be blank, only Member_count needs summarized

tarheel13
Rhodochrosite | Level 12

Okay, maybe someone else can help you then. That is the way I know how to make total rows in proc report and I think it sums all the numeric variables so you might have to change paid column to char if it's not already.

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

ok, thank you !!

I might change paid to character to see if it can work...

 

 

Reeza
Super User

Note that you used ANALYSIS after the total count column.

There are other designations for columns - DISPLAY and GROUP are the main other ones used. If you put a variable as DISPLAY it will not be summarized.

 

	define paid / display ' *Paid';

@tarheel13 wrote:

Okay, maybe someone else can help you then. That is the way I know how to make total rows in proc report and I think it sums all the numeric variables so you might have to change paid column to char if it's not already.


 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

 total = sum(Count) by LOB,  not need to sum the rest and showing on report ,  only member_count  summary need to be report, leave the rest of them blank ... on the Total line ... 

tarheel13
Rhodochrosite | Level 12

Please follow what @Reeza said. If you change paid to 'display' in my code, then it will give you what you wanted and yes, you should post code with the running man icon in your posts. It is rather hard to read the way you posted it.

Reeza
Super User

OP why are you posting code and data as tables?

Please post code using the code blocks and data preferably as a data step but if you cannot figure that out, tables are fine but don't assume we will interpret them correctly as the format goes wacky many times. 

 


@JHE wrote:
PROC REPORT  DATA=DATA_SAMPLE    
  COLUMNS MEMBER COUNT  PROGRAM  NAME PAID ;
  DEFINE TOTAL/COMPUTED;    
  DEFINE LOB/ORDER;    
  BREAK AFTER LOB/SUMMARIZED SUPPRESS;  
  COMPUTE BEFORE LOB;    
  TOB="TOTAL";      
  TOTAL=SUM(MEMBER_COUNT);    
  ENDCOMP;      
RUN;        

 

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
  • 12 replies
  • 1328 views
  • 5 likes
  • 3 in conversation