DATA Step, Macro, Functions and more

Proc report to show summary of new variable in grouped column

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 76
Accepted Solution

Proc report to show summary of new variable in grouped column

[ Edited ]

Hi - I am able to achieve the following using proc report.

Capture.PNG

 

however what I want is as follows:

Capture2.PNG

i.e, I want the total active to appear as a summary line below the type_label columns.

 

The code I have to date is below:

DATA WORK.saseg;
INFILE DATALINES DLM=',' MISSOVER DSD ;
INPUT
CumFrequency : BEST32. type : $CHAR6. description : $CHAR6. type_label : $CHAR16. total_visits : BEST32. variable : $CHAR11. ; DATALINES; 2294,period,Area 1,Reporting Period,191,23 (1) 2294,period,Area 2,Reporting Period,38,13 (0.6) 2294,period,Area 3,Reporting Period,263,105 (4.6) 2294,period,Area 4,Reporting Period,31,2 (0.1) 2294,period,Area 5,Reporting Period,69,63 (2.7) 2294,period,Area 6,Reporting Period,2488,1065 (46.4) 2294,period,Area 7,Reporting Period,7,0 (0) 3400,ytd,Area 1,YTD,486,62 (1.8) 3400,ytd,Area 2,YTD,128,58 (1.7) 3400,ytd,Area 3,YTD,654,40 (1.2) 3400,ytd,Area 4,YTD,73,4 (0.1) 3400,ytd,Area 5,YTD,224,50 (1.5) 3400,ytd,Area 6,YTD,6426,417 (12.3) 3400,ytd,Area 7,YTD,11,1 (0) ; proc report data= saseg; column description type_label , (variable total_visits cumfrequency); define description / group; define type_label /across ; define variable / center; define cumfrequency /mean ; format total_visits comma12.0 cumfrequency comma12.; label cumfrequency='Total Active' description='Variable of Interest' eft = 'No.(%)' total_visits='Total Visits' type_label='Visiting ...'; run;

 

Any help will be much appreciated.

 

Thanks,
Marie


Accepted Solutions
Solution
‎02-13-2017 05:46 PM
SAS Super FREQ
Posts: 8,740

Re: Proc report to show summary of new variable in grouped column

Hi:

  As explained, you can't do the merged cells, but you can put a summary line and move the Total Active under one of the other 2 columns on the row.

 

  See the example below.

 

cynthia

move_summary_info.png

View solution in original post


All Replies
PROC Star
Posts: 1,558

Re: Proc report to show summary of new variable in grouped column

You can't really change columns spans (except to creata full line), nor display unrelated values in a given column unless it is a computed column afaik.

Also your code is hard to use.

 

Solution
‎02-13-2017 05:46 PM
SAS Super FREQ
Posts: 8,740

Re: Proc report to show summary of new variable in grouped column

Hi:

  As explained, you can't do the merged cells, but you can put a summary line and move the Total Active under one of the other 2 columns on the row.

 

  See the example below.

 

cynthia

move_summary_info.png

Frequent Contributor
Posts: 76

Re: Proc report to show summary of new variable in grouped column

[ Edited ]

@Cynthia_sas The merged cell option would have been perfect, but this solution will work.  Thank-you!

Frequent Contributor
Posts: 76

Re: Proc report to show summary of new variable in grouped column

[ Edited ]

@ChrisNZ Thanks - I didn't realise the original code I entered had been formatted on one line.. the editing block showed each statement on its own line. Anyway I copied it, pasted it into notepad and pasted it back here and now seems to display a bit better ... ( I believe).

Super User
Posts: 10,466

Re: Proc report to show summary of new variable in grouped column

The code box with {i} is better for plain text though I've had that jumble things a couple of times. The "Run" icon accepts some formatting codes and as such one in awhile the seems to miss the "start" or "end" of something tag in a copy/paste.

☑ This topic is SOLVED.

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

Discussion stats
  • 5 replies
  • 172 views
  • 0 likes
  • 4 in conversation