Help with Summarize in Proc Report

Reply
N/A
Posts: 1

Help with Summarize in Proc Report

I want to calculate the total of a computed column psi_current by "rbreak after / summarize". However, it returns 0 not the total of the column. On the other hand, it does calculate the total of 2 other computed columns all and overall_pct. Your help will be much appreciated. Thanks a lot. Here is my code in SAS. Please note that I omit some formatting just to save typing:

proc report data = val;

   column RS11_Bin vintage_month, (n pct cum) all overall_pct psi_current;

   define RS11_Bin / group;

   define vintage_month /across;

   define pct /computed;

   define cum /computed;

   define all /computed;

   define overall_pct / computed;

   define psi_current / computed;

   compute before;

       den0 = _c2_; den1 = _c5_; den3 = _c8_; den4 = _c11_;

   endcomp;

   compute pct;

      _c3_ = _c2_/den0;

      _c6_ = _c5_/den1;

      _c9_ = _c8_/den2;

     _c12_ = _c11_/den3;

  endcomp;

  compute all;

      all = sum(_c5_, _c8_, _c11_);

      temp0 + _c3_;

      _c4_ = temp0;

      temp1 + _c6_;

      _c7_ = temp1;

      temp2 + _c9_;

      _c10_ = temp2;

      temp3 + _c12_;

      _c13_ = temp3;

  endcomp;

  compute overall_pct;

      overall_pct = _c14_/den4;

  endcomp;

  compute psi_current;

      psi_current = (_c12_ - _c3_) * log ( _c12_/_c3_) ;

  endcomp;

   rbreak after /summarize;

   compute after;

       RS11_bin = 'Total';

run;

Ask a Question
Discussion stats
  • 0 replies
  • 174 views
  • 0 likes
  • 1 in conversation