I have a following code:
visitnum = put(visitn,visitnumber.);
which is directed to
proc format;
value visitnumber
'Screening Assessment' = 1
'Treatment Visit - Day 1' = 2
'Treatment Visit - Day 7' = 3
'Treatment Visit - Day 14/15' = 4
'Follow-Up Visit - Day 28' = 5
run;
However when I output the 'visitnum' variable, it gives the 'Treatmen' as the output for the matching columns.
Your description of the result appears to indicate that the input string did not match any of the values the format knows about. In that case the PUT() function will just echo the input. Truncation could occur if the width of the format specification used in the PUT() function call is shorter than the length of the input string. Or truncation could happen if the target variable VISITNUM is defined shorter than the string returned by the PUT() function.
So either the value of VISITN does not match any of the values the FORMAT knows about or the format was not found.