The fmtLibCntlIn action creates a format library from a control table. This is useful for importing format definitions stored in a CAS table, similar to the CNTLIN= option in the PROC FORMAT procedure. The input table must adhere to the structure required for format control data sets (containing variables like FMTNAME, START, LABEL, etc.).
| Parameter | Description |
|---|---|
| fmtLibName | Specifies the name of the format library to be created in the current session. |
| table | Specifies the settings for the input table containing the format control data. This includes the table name, caslib, and optional filtering (WHERE clause) or computed variables. |
Create a CAS table named 'formats_data' with format definitions for a traffic light color scheme.
| 1 | |
| 2 | DATA casuser.formats_data; |
| 3 | LENGTH fmtname $32 start $16 label $32; |
| 4 | fmtname='$traffic'; |
| 5 | start='R'; |
| 6 | label='Red'; |
| 7 | OUTPUT; |
| 8 | fmtname='$traffic'; |
| 9 | start='Y'; |
| 10 | label='Yellow'; |
| 11 | OUTPUT; |
| 12 | fmtname='$traffic'; |
| 13 | start='G'; |
| 14 | label='Green'; |
| 15 | OUTPUT; |
| 16 | |
| 17 | RUN; |
| 18 |
Create a format library named 'TrafficFmt' from the 'formats_data' control table.
| 1 | |
| 2 | PROC CAS; |
| 3 | sessionProp.fmtLibCntlIn / fmtLibName="TrafficFmt" TABLE={name="formats_data", caslib="casuser"}; |
| 4 | |
| 5 | RUN; |
| 6 |
Create a format library named 'RedOnly' by applying a filter to the input table to only include the 'Red' definition.
| 1 | |
| 2 | PROC CAS; |
| 3 | sessionProp.fmtLibCntlIn / fmtLibName="RedOnly" TABLE={name="formats_data", caslib="casuser", where="start='R'"}; |
| 4 | |
| 5 | RUN; |
| 6 |