I have dataset that looks like this:
ID Date Calendar_Yr
1 07/04/2023 2023
1 09/01/2023 2023
1 02/01/2024 2024
1 04/04/2024 2024
I would like to have a dataset that looks like this:
ID Date Calendar_Yr
1 07/04/2023 CY 2023
1 09/01/2023 CY 2023
1 02/01/2024 CY 2024
1 04/04/2024 CY 2024
Can put the column CY_Year into a macro variable and then try a do loop around a "if/then Column Name = "CY &CY_Year."
There is no need for looping to create your new variable.
In general you use macro code to generate code, but there is no code generation needed for this problem.