Let's parse a bit of what SAS is going to do with a character value of 202103.
year = year(yrmth);
The year function expects a numeric value that hopefully is a date value. So '202103' gets turned into a numeric value of 202103 by SAS attempting to correct data to the proper expected form (generating NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column). ) Since the number value 202103 corresponds to 04MAY2513 the value of the variable year is 2513.
The QTR function then does the same conversion to numeric for YrMth, resulting in the same 04May2513 date, and reports the quarter is 2 (May being in the second quarter) and Quarter is "Q2".
The Year and Month functions repeat the same conversion so Curr_month ends up as 251305 (May being the 5th month).
I can't guess what value Month2 has because we don't have the format $mth but it would be based on May or '05' .
... View more