Published on :
Data Management CREATION_INTERNE

Creating Custom Format for Cylinders

This code is also available in: Deutsch Español Français
Awaiting validation
The script starts by defining a SAS© library 'dats' pointing to a specific directory. It then uses the FORMAT procedure to create a numeric format 'cylf' that associates the numbers 4, 6, and 8 with explicit textual labels. This format is permanently stored in the 'carformats' catalog of the 'dats' library.
Data Analysis

Type : CREATION_INTERNE


The format definitions (values and labels) are hardcoded in the script via the VALUE statement.

1 Code Block
LIBNAME
Explanation :
Declaration of the 'dats' library pointing to the specified system path.
Copied!
1LIBNAME dats "/folders/myshortcuts/IntroSAS/datasets";
2 
2 Code Block
PROC FORMAT Data
Explanation :
Creation of the 'cylf' format and storage in the 'carformats' catalog of the 'dats' library.
Copied!
1PROC FORMAT library = dats.carformats;
2VALUE cylf
3 4 = "4 Cylinders"
4 6 = "6 Cylinders"
5 8 = "8 Cylinders"
6 ;
7RUN;
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.