Having your SAS log pasted in your post will be much better for helping you diagnose your challenge. Also, you will stand to benefit by adding statements (you increment "nnn" for each command for identification in your program execution):
PUTLOG '>DIAG-nnn>' / _ALL_;
You are treating REVCD as a char variable - do you have a LENGTH associated (not FORMAT)? Same for TOTCHG - you are using a PUT which assigns a CHAR type variable -is that what you want?
So, you appear to be doing an OUTPUT, even if the variable i_REVENUE_CODE1 is blank - have you done a FREQ on this variable to see what values exist and to ensure all obs are populated? Same question posed for variable i_REVENUE_CODE2 through i_REVENUE_CODE20 which will help debug your MISSING VALUE condition for TOTCHG.
There is no KEEP (or conversely a DROP) statement in your OUTPUT file - you should have all variables available in a PROC PRINT (or PROC FREQ) against the entire output file, again to help with determining the cause.
Suggest you select one or two obs, rerun your program, and then re-post a reply with the SAS log pasted in the reply, however after some PUTLOG commands to debug the code-path and what occurs with each type of input observation.
Scott Barry
SBBWorks, Inc.