Review the SASLOG output closely - you will see a SAS diagnostic message which you may have overlooked, shown below:
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
Also, you most likely do not have a fixed-length (RECFM=F) record/file layout providing data (again info revealed in the INFILE diagnostic of your SAS log) in columns 1 through 25 on each record, so SAS is assigning a missing value.
First you must specify TRUNCOVER or MISSOVER, possibly -- review the INFILE statement coding. And second you want to review the INPUT statement processing to handle the shorter record length, rather than using the INPUT statement you have coded. I don't believe that this behavior is unique to the mainframe either - it is related to the input file layout and record format for your data.
For diagnostic information (self-debugging), consider adding either a :
...or.... (tip: get to SAS 9 as soon as possble so you can use PUTLOG -- and so you can be on a supported SAS version):
Also, consider adding a sort step for your input file before you use BY processing. And I would encourage you to code a LENGTH statement to declare MNAME length explicitly.
Your example actually didn't have spaces but were null strings (empty).
From the online help for input statement, column:
Both leading and trailing blanks within the field are ignored. Therefore, if numeric values contain blanks that represent zeros or if you want to retain leading and trailing blanks in character values, read the value with an informat. See INPUT Statement, Formatted.
Missing data do not require a place-holder. The INPUT statement interprets a blank field as missing and reads other values correctly. If a numeric or character field contains a single period, the variable value is set to missing.