Genstat supports the import of SAS value labels for SAS v7-9 files. SAS, unlike other systems, stores value labels as custom “formats,” in a separate “catalogue” file. This file is usually named as “formats.sas7bcat”, and by default is stored in a SAS user library in a separate location to the SAS data file. Alternatively, rather than reading directly from the catalogue file, you can create a value label file using SAS itself. This file contains the same information as the catalogue file, but is in a more portable format for Genstat to read.
When opening the SAS file you will be prompted for the catalogue or value label file. Answer Yes to the query “Do you want to specify a PROC FORMAT file for the dataset?” if you have created this file for the value labels or have a catalogue file. If you respond with Yes, it will then prompt for a catalogue file or a file containing the value labels created with the PROC FORMAT statement (as below). By default, it will look for a file formats.sas7bcat in the same directory as the input file. The selected file will be used to transfer your variable labels.
Creating a file with the PROC FORMAT statement
To create a file for Genstat to use for reading your SAS value labels, you will need to go into SAS and run the following small program:
libname mylib ‘<path to SAS file>’;
proc format library = mylib cntlout = mylib.sas_fmts;
where ‘<path to SAS file>‘ is the directory that contains your input data file.
This procedure creates a SAS file in the directory ‘<path to SAS file>‘ that has the format information for each SAS data file. In this case, the file will have the name sas_fmts.sas7bdat and it will be found in the same directory as the input file.
Restrictions on importing value labels
SAS catalogue files not only support conventional value labels (the one-to-one mapping of a string to a single number), but also the mapping of a range of numeric values to a single string (for example, zip code mapped to state). However, Genstat will only import conventional one-to-one value labels from SAS.