Hi everyone!
I have a dataset with policies date began between 2018-01-01 and 2019-12-31 (2 years) that has the following info:
policy policy_beg_date policy_end_date a 01-02-2018 06-02-2018 b 04-02-2019 02-04-2020 c 23-12-2019 03-02-2020 d 02-02-2019
policy begining date (date that policy started) and policy end date (date that policy ended - is missing if policy is still active)
I would like to create flags of 13 months (flag_0month, flag_1month,....flag_13month) where i give 1 if policy is active in month 0, month1, and so on....where month0 is the month of beginnig, month1 is month of begining + 1 and so on so i would have something like this:
policy policy_beg_date policy_end_date month_begining month_end act_month0 act_month1 act_month2 a 01-01-2018 06-01-2018 201801 201801 1 b 04-02-2019 02-04-2020 201902 202003 1 1 1 c 23-12-2019 03-02-2020 201912 202002 1 1 1 d 02-02-2019 201902 1 1 1
Can anyone please help me achivieng this?
I already tryied someting like in this post : https://communities.sas.com/t5/SAS-Programming/How-to-create-a-flag-for-each-month-lying-between-2-d... but i get errors and i think it's not the same as i need.
Thank you!!
So you want to check for only 13 months, even if the policy runs for a longer term?
How many months should be checked if the end date is missing and 13 months from the start date would be in the future?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.