Published on :
Data Management CREATION_INTERNE

Definition of Custom Formats for States and Sex

This code is also available in: Deutsch Español Français
This script uses the FORMAT procedure to define mapping rules (VALUE). The 'state_f' format translates geographic codes (12, 25, 27) into US state names. The 'sex_f' format standardizes gender codes (1, 2) and handles missing or unknown values (7, 9).
Data Analysis

Type : CREATION_INTERNE


Key-value mappings are statically defined in the code via the VALUE statement.

1 Code Block
PROC FORMAT
Explanation :
Execution of the FORMAT procedure to store 'state_f' and 'sex_f' definitions in the WORK library's format catalog (by default).
Copied!
1PROC FORMAT;
2 value state_f
3 12 = "Florida"
4 25 = "Massachusetts"
5 27 = "Minnesota"
6 ;
7 value sex_f
8 1 = "Male"
9 2 = "Female"
10 7 = "Unknown"
11 9 = "Unknown"
12 ;
13RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.