首页 > IT职业 > IT生活 > SAS Proc Format
SAS day 54
We know Format is a common function to convert date in SAS, such as, format aestdt date9. .
What about Proc Format? When and how should we use it?

Syntax:
Proc Format;
INVALUE sexfmt 1=1 2=2;
VALUE sexfmt 2='Male' 1='Female';run;
proc freq data=adsl order=formatted;
tables sexn/out=a;
format sexn sexfmt.;
run;
Output:

Syntax:
Note: we need to use $ to format character values
proc format; value $cf "FRANCE"="FRA" "GERMANY"="GER" "ITALY"="ITA"; run;
proc freq data=co;
tables country/out=q;
format country $cf.;
run;
Output:
Alternative Solution:
we can always use if…then… clause to change the output format name.
Happy Studying!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1371/viewspace-2824819/ ,如需转载,请注明出处,否则将追究法律责任。