I have a sample Input Dataset with
Date
ID
Status
Insured
Then i derive two addition columns 'STATUS FLAG' & INSURANCE FLAG' based on some sample random conditions up to this point is fine.
The key point here is
I want to scan through all My IDs and then apply the 'STATUS FLAG' & INSURANCE FLAG' logic and bring the desired expected output as attached..

Note that the solution should not be just based on transposing or crosstab to get the desired output rather i want the
STATUS FLAG' & INSURANCE FLAG' logic should be applied vertically and bring the desired result output.