BookmarkSubscribeRSS Feed
debrahudson
Calcite | Level 5

Does anyone know if you can use summarize in proc report to find the difference between to columns?  Or for that matter, just to add a row to find the difference between two rows?

 Employee
Period1159,574
Period2167,530
Change-7,956
  
 Member
Period16,788
Period27,261
Change-473
2 REPLIES 2
PaigeMiller
Diamond | Level 26

Its really unclear to me what you are asking. You want the "difference between to [sic] columns", but the only two columns shown are character strings in the left column and numbers in the right column, and you cannot compute a difference between character string and numbers.

 

Please start by showing us (a portion of) the data that goes into PROC REPORT. Then explain and show us clearly what the desired results are from PROC REPORT.

--
Paige Miller
debrahudson
Calcite | Level 5

I've been asked to automate the existing report.  I'm having trouble with creating the change line below.  I'm hoping somehow I can just use that summarize command to create the change but I do not know how to change the summarize function to be a difference.  Any help anyone can provide would be appreciated.

thanks!

 

ods _all_ close;
ods noresults; /*closes resluts window and directs output to file */

ods excel file="&file"
options(start_at= "1,1" flow = "table" sheet_name = "Active"
sheet_interval="none" embedded_titles='yes' absolute_column_width= "45,10,10,10,10,10,10,10,10,10,10,10,10,10,10" row_heights="40,15"
embedded_footnotes='yes') style=SASDocPrinter;

ODS ESCAPECHAR='^';

title1 justify=center;

proc report data = QTR_MBRSP split='|'
style(column) = {FONT = ('ARIAL') fontsize = 8.5pt}
style(header) = {FONT = ('ARIAL') fontsize = 9.5pt fontweight =bold }
style(report) = {FONT = ('ARIAL') fontsize = 9.5pt }
headline headskip;
columns Type Period contracts Adults children ;
define Type / group;
define Period / group ' ' ;
define contracts / 'Employee|Months' computed ;

define Adults / 'Member|Months' analysis ;
define children / 'Percent|Adult' analysis ;

compute after Type;
line ' ';
endcomp;


break after Type / skip summarize
style ={font_size=10pt font_face=Arial fontweight=bold} ;

run;
ods excel close;

Active

 

Employee

Member

 

Period1

159,574

3

 

Period2

167,530

2

 

Change

-7,956

1

    

Satellite

 

 
 

Period1

6,788

12,562

 

Period2

7,261

13,703

 

Change

-473

-1,141

    

Direct Pay

  
 

Period1

3,901

6,215

 

Period2

8,586

13,926

 

Change

-4,685

-7,711

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 647 views
  • 0 likes
  • 2 in conversation