11-28-2016 12:41 PM
Hey there, as the title says, how can I make the numberic missing value (format: BEST12., informat: 12.) showed as 'NA' in below data set?
I tried to use put() statement to transform numeric variables to character first, but the transformation doesn't work.
11-28-2016 03:31 PM
11-28-2016 05:20 PM
You need to assign the format to your variables too. This code works for me. You may also need to tell your data viewer what to display: different machines have different defaults and can either show raw or formatted values.
proc format; value NA .='NA'; run; data test; a = .; b=1; c=1; output; a = 1; b=.; c=1; output; a = 1; b=1; c=.; output; format a b c NA.; run;
11-28-2016 07:03 PM
The NUMERIC variables of your array ZERO are still numeric.
zero [i] = 'NA' will fail as 'NA' isn't acceptable. And that is what you are doing with the PUT statement.
format _numeric_ trouble.;
12-02-2016 11:53 AM
Change the variable(s) to a characters
Use a case statement to apply the NA values in the transformation otherwise that value.
It may be more appropriate to transpose the dataset before applying as this will mean less cols to change.