Reading SAS Value Labels
Previous Topic  Next Topic 

Stat/Transfer can read SAS user-defined formats (value labels) directly from a Windows SAS catalog file, from a catalog or data set in a CPORT library, from SAS data files for all supported platforms, and from a SAS Transport library.


SAS Value Labels - Reading

You can choose whether and how user-defined formats are to be read using the selections from the drop down menu.


Do not read formats

If this option, the default, is selected, no formats will be read.


Read directly from a catalog file (.sas7bcat)

If you have a Windows SAS catalog file containing formats and wish to read them, select Read directly from a catalog file.


If this option is selected, the entry '%ipath%/formats.sas7bcat' will automatically appear on the Format Filename line.  This instructs Stat/Transfer to look for a file named formats.sas7bdat in the same directory as your data file.


You can change the path if your file is in a different location.


Read from a catalog in a CPORT Library (.stc)

Select this option if you have a Windows CPORT library file that contains the formats for your data set.  (Your data will usually be read from a CPORT file as well, but need not be.)


If this option is selected, the entry '%ipath%/%iname.stc' will automatically appear on the Format Filename line.  This instructs Stat/Transfer to look for a file with the same name as your input file and the extension .stc, in the same directory as your data file.


You can change the path if your file is in a different location.


If the Use default catalog name box is checked, Stat/Transfer will look in the CPORT file for a catalog named formats, which is the SAS default.  If you would like to read your formats from a different catalog, uncheck the box, and then click on the Read Library button to get a list of catalogs in the CPORT file.  You can then select the catalog that contains the formats that are appropriate for your data.


Read a SAS datafile (.sas7bdat)

The selection, Read a SAS datafile, is the appropriate option if you are working on a SAS platform other than Windows and wish to read user-defined formats.  As described in the section SAS Value Labels, for cases where you are not working in Windows, Stat/Transfer can read user-defined formats that are  produced in SAS data set form by PROC FORMAT using the 'cntlout' keyword.


When this option is selected, then by default, Stat/Transfer will look in the same directory as your input data set for a file named sas_fmts.ext, where .ext is the extension of your input file.  If you would like to use a file located somewhere else or with a different name, you can change it in the Format Filename edit box.  You can type in a complete file specification, or you can use the macros below as part of the file specification.


%ipath% The path, including the directory, of the input file

%iname% The name, without the extension, of the input file

%iext% The extension, without the dot, of the input file


Read from a dataset in a CPORT Library (.stc)

This option is appropriate if your formats were written with the 'cntlout' option of PROC FORMAT into a CPORT library.


If this option is selected, the entry '%ipath%/%iname.stc' will automatically appear on the Format Filename line.  This instructs Stat/Transfer to look in the same directory as your data file for a file with the same name as your input file and the extension .stc.


You can change the path if your file is in a different location.


If  the Use default dataset name box is checked, Stat/Transfer will look in the CPORT file for a data set named sas_fmts.  If you would like to read your formats from a different data set, uncheck the box, and then click on the Read Library button to get list of data sets in the CPORT file.  You can then check the data set that contains the formats that are appropriate for your data.


Read from a SAS Transport Library (.tpt)

This option is appropriate if your formats were written with the 'cntlout' option of PROC FORMAT into a Transport library.  This is a very good way of transporting formats from an unsupported platform, such as IBM mainframe SAS.


If this option is selected, the entry '%ipath%/%iname.tpt' will automatically appear on the Format Filename line.  This instructs Stat/Transfer to look for a file with the same name as your input file and the extension .tpt in the same directory as your data file. You can change the path if your file is in a different location.


If the box Use default member names is checked, Stat/Transfer will look in the Transport file for a member named sas_fmts.  If you would like to read your formats from a different member, uncheck the box, and then click on the Read Library button to get a list of members in the Transport file.  You can then check the member that contains the formats that are appropriate for your data.



Continue if the format file is not found

If Stat/Transfer is told to look for a user-defined format file of some type and the file containing the labels is not found when a transfer is initiated, by default the transfer will stop and an error message will be generated.


If the box Continue if the format file is not found is checked, processing will continue in spite of the error. Value labels will not be written to the output file.



Continue if there is an error processing formats

This will instruct Stat/Transfer to continue processing if there is an error reading the format file or if no matching formats are found in the file.