Help using Base SAS procedures

PROC TABULATE conditionnal computed columns.

Reply
N/A
Posts: 0

PROC TABULATE conditionnal computed columns.

Hello,

I have come accross a problem regarding the computed columns from a tabulate procedure.

Basically, I would like column "Arrears Rate" to be calculated as "Arrears" / "Total Insured Amount" in each row of the table, but ONLY when there is an Insured Amount. If there are none, I would like the cell to be either empty or have a dot.

I've tried the conditionnal approach with IF statements (in the code itself or by running a summary table automated procedure from SAS EG). Nothing worked.

So, is there a way I can use conditionnal computed columns?

Thanks in advance.
Trusted Advisor
Posts: 1,423

Re: PROC TABULATE conditionnal computed columns.

Difficult to reply without the actual data, but this works, if that's what you want:
[pre]
data t;
CUS=1; ARREARS=1; INS=3; output;
CUS=1; ARREARS=1; INS=1; output;
CUS=2; ARREARS=1; INS=0; output;
run;
option nocenter formchar='|========================';
proc tabulate;
class CUS;
var ARREARS INS;
table CUS, ARREARS*sum INS*sum ARREARS*pctsum='Rate';
run;
===============================================================
| | ARREARS | INS | ARREARS |
| ========================================
| | Sum | Sum | Rate |
===============================================================
|CUS | | | |
======================== | | |
|1 | 2.00| 4.00| 50.00|
===============================================================
|2 | 1.00| 0.00| .|
===============================================================
N/A
Posts: 0

Re: PROC TABULATE conditionnal computed columns.

Hello,

I'm sorry I didn't put enough information in my previous post. Good news though : I got the general idea of what you suggested to do and it worked fine on my end.

Thank you very much.
Ask a Question
Discussion stats
  • 2 replies
  • 59 views
  • 0 likes
  • 2 in conversation