Creating a Formats File with PROC FORMAT (GET SAS command)
The following is an example of how to create a SAS format catalog file:
libname mylib 'c:\mydir\' ;
proc format library = mylib ;
value YesNo
0='No'
1='Yes' ;
value HighLow
1 = 'Low'
2 = 'Medium'
3 = 'High' ;
options fmtsearch=(mylib);
proc datasets library = mylib ;
modify mydata;
format var1 var2 var3 YesNo.;
format var4 var5 var6 HighLow.;
quit;
-
libname
defines a "library," which is a directory path. -
proc format
defines two formats: YesNo and HighLow. Each format defines a set of value labels associated with data values. -
proc datasets
identifies the data file--mydata--and the variables to which each of the defined formats should be applied. So the YesNo format is applied to variables var1, var2, and var3, and the HighLow format is applied to the variables var4, var5, and var6. - This creates the SAS catalog file c:\mydir\formats.sas7bcat.