Hi:
If FLAG2 is CHARACTER, then this statement
[pre]
if flag2 ne . then lngstr = text ;
else if flag2 = 1 then lngstr = catx(' ',lngstr,text);
[/pre]
should be causing a note in the log:
[pre]
NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
[/pre]
This IF statement is forcing FLAG2 to be treated as a NUMBER, not a CHARACTER -- it might not make any difference for a simple test like what you're doing, but it is better to get these concepts straight from the beginning.
However, I see a different problem. In the data that I posted, the values for FLAG2 are 7, 12, 55 and . or as character strings they would be '7', '12', '55' and '.'. None of the FLAG2 variables has a value of 1. On the other hand, FLAG1 has values of 1 and 2, so I'm wondering whether you've posted working code.
cynthia