Enables you to specify a character format at run time.
Category: | Special |
proc format; value typefmt 1='$groupx' 2='$groupy' 3='$groupz'; value $groupx 'positive'='agree' 'negative'='disagree' 'neutral'='notsure '; value $groupy 'positive'='accept' 'negative'='reject' 'neutral'='possible'; value $groupz 'positive'='pass ' 'negative'='fail' 'neutral'='retest'; run; data answers; length word $ 8; input type response $; respfmt = put(type, typefmt.); word = putc(response, respfmt); datalines; 1 positive 1 negative 1 neutral 2 positive 2 negative 2 neutral 3 positive 3 negative 3 neutral ;
proc print data=answers; run; SAS log: Obs word type response respfmt 1 agree 1 positive $groupx 2 disagree 1 negative $groupx 3 notsure 1 neutral $groupx 4 accept 2 positive $groupy 5 reject 2 negative $groupy 6 possible 2 neutral $groupy 7 pass 3 positive $groupz 8 fail 3 negative $groupz 9 retest 3 neutral $groupz