In your current approach, you are converting a date(&pbd_date) to a string (&M). You are then trying to convert this date back to a string before performing calculations. You can greatly simplify the process if you use the original date . data _null_; call symput('m',put(&pbd_date,yymmdd10.)); call symput('curr_month1', put(intnx('month',(&pbd_date,- 1,'e'),yymmdd10.); call symput('prev_month1', put(intnx('month',(&pbd_date,-2,'e'),yymmdd10.); run; The reason this works is because &m is not an actual date, but rather a string. If you want to stay with your previous approach, you can do that using an informat: input(&m,yymmdd10.).
... View more