Q: are the values for fromdate and todate really strings or are these SAS date values with a SAS date format assigned? You can easily check this by running a PROC CONTENTS.
Q: Your example data shows the same dates for fromdate and todate. Is this how your data really looks like? And would that mean that these 2 cases wouldn't be counted anywhere?
Q: What happens if a risk period (fromdate to todate) goes over a monthend. Should this risk be counted in 2 months? Or only when it started?
Forget about using any macro code. It won't be needed.
What most likely has to be done is creating some additional observations (i.e. one obs per month where the risk exists) and then a PROC TABULATE with an appropriate format applied to the variable containing the date.
Have also a look at functions like INTCK() and INTNX().
Please provide also some "real" sample data, best in form of a data step creating a SAS table.