pyll
pyll

Reputation: 1764

SAS PROC REPORT

I have the following dataset (fictional data):

data have;
    input team $ goals_12 goals_13 var_12_13;
cards;
LIV 20 25 .25
MNC 21 24 .14
MUN 30 25 -.17
ARS 10 12 .20
CHE 23 23 0
EVE 20 18 -.1
TOT 10 0 -1
;
run;

I am trying to create a report for this dataset. Here is what I have:

proc report data=have;
    column team goals_12 goals_13 var_12_13;
    define team / 'Team';
    define goals_12 / analysis '2012 Goals';
    define goals_13 / analysis '2013 Goals';
    define var_12_13 / order analysis format=percent. mean "Variance '12 to '13";
    rbreak after / summarize ul ol;
run;

This does ALMOST everything I want. The following things I have not been able to figure out:

  1. Name the summary row 'Summary'
  2. Order by descending var_12_13 so team with highest variance is first
  3. I need the summary of the variance column to be the variance of the totals, not the mean of the variances (so it should be -5%)

Upvotes: 0

Views: 385

Answers (1)

davids12
davids12

Reputation: 323

Try this:

proc sort data=work.have; by descending var_12_13;

proc report data=have;
    column team goals_12 goals_13 var_12_13;
    define team / 'Team';
    define goals_12 / analysis '2012 Goals';
    define goals_13 / analysis '2013 Goals';
    define var_12_13 / order=data analysis format=percent. mean "Variance '12 to '13" weight=goals_13;

    compute team;
    if _BREAK_ in ('_RBREAK_') 
        then do;
            team="Summary";
        end;
    endcomp;

    rbreak after / summarize ul ol;
run;

Upvotes: 1

Related Questions