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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 714 views
  • 0 likes
  • 2 in conversation