BookmarkSubscribeRSS Feed
Charlotte37
Fluorite | Level 6

Hello,

 

I have a table with the history of insured persons by contract.

 

For example, the A contract have 2 insured persons valid.

 

CONTRACT_NUMBERRANKNAME_RANKSTATUSSUBSCRIPTION_DATECANCELLATION_DATEBIRTHDAY_MAIN_INSURED
A1main insuredremoved01/10/200520/01/200701/05/1976
B1main insuredvalid01/01/2019 15/09/1955
B2spousevalid01/06/2019 15/09/1955
C1main insuredvalid01/01/2019 04/07/1982
C2spousevalid01/01/2019 04/07/1982
D1main insuredvalid01/03/2009 02/08/1944
D2spouseremoved01/05/201015/09/201802/08/1944

 

I have a 2nde table with the amount of contributions :

 

AgeIndividual_MembershipCollective_Membership
Until 29 years old844,8
From 30 to 65 years old included22,444,8
From 66 to 70 years old included27,254,4
From 703468

 

 

I want to know the amount of the contributions of each contract for each year.

If a contract has only one insured then the amount is in the column "Individual_Membership" otherwise in the column "Collective_Membership".

 

if the contract starts in "individually" in the year and ends in "collective" then it is necessary to prorate the amounts.

The transition to the senior slice is 01/01 of the following year

 

My final table :

 

CONTRACT_NUMBERYEARAMOUNT
A20052,02
A20068
A20071,23
B20199,23 + 26,27 = 35,5
C201944,8
D200918,78
D20108,94 + 36,52 = 45,46
D201154,4
D201254,4
D201354,4
D201454,4
D201568
D201668
D201768
D201848,07 + 9,97 = 58,04
D201934

 

 

Thank you very much for your help

2 REPLIES 2
PaigeMiller
Diamond | Level 26

@Charlotte37 wrote:

I have a table with the history of insured persons by contract.

 

For example, the A contract have 2 insured persons valid.

 

CONTRACT_NUMBER RANK NAME_RANK STATUS SUBSCRIPTION_DATE CANCELLATION_DATE BIRTHDAY_MAIN_INSURED
A 1 main insured removed 01/10/2005 20/01/2007 01/05/1976
B 1 main insured valid 01/01/2019   15/09/1955
B 2 spouse valid 01/06/2019   15/09/1955
C 1 main insured valid 01/01/2019   04/07/1982
C 2 spouse valid 01/01/2019   04/07/1982
D 1 main insured valid 01/03/2009   02/08/1944
D 2 spouse removed 01/05/2010 15/09/2018 02/08/1944

 

I'm sorry, I don't see how A has two insured persons.

--
Paige Miller
Charlotte37
Fluorite | Level 6

It's a mistake.

The A contract have 1 insured person valid whereas the others have 2 insured persons valid

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

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