Some things that cannot be told from a picture that you may need to explain in considerable detail.
"same as per the previous month" means that we need to be able to tell just what a "previous month" would be. If your values for "month" are character then the "previous" can have a somewhat slippery meaning as 1 ) there is no YEAR present. So if you have JAN and DEC for the same account we cannot tell which is previous to which.
Second if the value of month are character then "previous" as in "before" typically means the value order. But with character values APR comes before JAN and any comparison is going to be nasty as is.
SAS has several tools to deal with sequential processing once the data is in sequence but we cannot tell if the first step is going to be coding that involves allowing placing the months in order and see the comment above about YEAR that may be involved with that.
... View more