Hello, I am working with a secondary dataset that includes a rather complicated variable where some levels have many trailing zeros. For some reason, not all levels are included when I create a new variable based on the original variable levels. For example, one of the levels for the variable is 1020405100000 (n=16). But when I try to test the creation of a new variable based just on this value using the code below, it does not display the appropriate output of 16. Rather it says "level=0." This pattern continues for levels for this variable that include trailing zeros. However, if I insert shorter levels of the variable such as 1110 (n=20) in the below code, the new variable accurately reflects n=20. if q12=1020405100000 then newvar=1; It was suggested that I attempt to truncate the variable to see this would solve the problem. So instead of having: 1 1020405100000 2 10304051000000000 ....; It would be: 1 102040510 2 103040510 ...; Do you think this would solve the issue? If so, how is the best way to truncate the variable and remove the trailing zeros? Thank you for any help.
... View more