BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
2 REPLIES 2
ChrisNZ
Tourmaline | Level 20
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| .|
===============================================================
deleted_user
Not applicable
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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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