parse_formats {DescrTab2}R Documentation

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"
)

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

Value

A named list with format definitions

Examples

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

[Package DescrTab2 version 2.1.16 Index]