Learn R Programming

DescrTab2 (version 2.1.16)

parse_formats: Parse a text file containing format information

Description

Useful to extract factor formatting information contained in a proc format SAS statement.

Usage

parse_formats(
  path_to_format_definition,
  ignore_keywords = c("value"),
  encoding = "ISO-8859-1"
)

Value

A named list with format definitions

Arguments

path_to_format_definition

(string) Path to the text file to be parsed

ignore_keywords

A vector of keywords to be ignored when searching for the name of the variable to be formatted

encoding

Encoding for the text file

Examples

Run this code
tmpfile <- tempfile()
write(     "proc format;
             value yn  1=\"yes\"
                       0=\"no\";
             value sex 1=\"female\"
                       0=\"male\";
              run;",tmpfile)
parse_formats(tmpfile)

Run the code above in your browser using DataLab