I am trying to create a dummy variable that =1 if an individual's birthday falls within the 99 days that precede the beginning of Ramadan, and =0 otherwise for every year dating back to 1960.
I’ve had success by converting all the dates into the Julian calendar (uses the numerical value of the date out of 365. For example, January = 0, February = 31, July = 181 and so on. Then add the day for your Julian calendar equivalence. July 31st would be 181 + 31 = 212). From there, I can subtract 99 and obtain the appropriate interval, and birthdays that fall within that interval are set equal to 1.
However, my problem arrises when the interval falls back into the previous year. For example, January 7th would be 0+7=7. Subtract 99, and I get -92, when it should be 273 of the previous year. Is there a simpler approach that I can be taking?
I’ve had success by converting all the dates into the Julian calendar (uses the numerical value of the date out of 365. For example, January = 0, February = 31, July = 181 and so on. Then add the day for your Julian calendar equivalence. July 31st would be 181 + 31 = 212). From there, I can subtract 99 and obtain the appropriate interval, and birthdays that fall within that interval are set equal to 1.
However, my problem arrises when the interval falls back into the previous year. For example, January 7th would be 0+7=7. Subtract 99, and I get -92, when it should be 273 of the previous year. Is there a simpler approach that I can be taking?

Comment