Reduce field lengths by converting the field using a format.
For lengthy fields in datasets
with large numbers of observations, space can be saved by reformatting
the value into a different value and hence holding a smaller field. The
following example reads the inventory file, selecting only
installations with certain products.
Proc Format;
InValue Prods ‘A12345’=1
‘A23456’=2
‘A34567’=3
‘A45678’=4
Other=0;
Data Invents(Keep=Instid ProdId);
Length ProdId 2;
Infile Invents;
Input @15 ProdId Prods.@;
If ProdId;
Input @1 InstId $12.;
This new dataset holds only 14 bytes per observation rather than 18.