| fimport | R Documentation |
Reads a CSV file produced by 'SAS' PROC FORMAT with
CNTLOUT= option (typically exported via PROC EXPORT)
and converts compatible format definitions into ks_format and
ks_invalue objects.
fimport(file, register = TRUE, overwrite = TRUE)
file |
Path to the CSV file exported from a SAS format catalogue. |
register |
Logical; if |
overwrite |
Logical; if |
The 'SAS' format catalogue CSV is expected to contain the standard CNTLOUT
columns: FMTNAME, START, END, LABEL,
TYPE, HLO, SEXCL, EEXCL.
Supported SAS format types:
NNumeric VALUE format \to ks_format with
type = "numeric"
CCharacter VALUE format \to ks_format with
type = "character"
INumeric INVALUE (informat) \to ks_invalue
with target_type = "numeric"
JCharacter INVALUE (informat) \to ks_invalue
with target_type = "character"
Incompatible types (logged with a warning):
PPICTURE formats - no equivalent in ksformat
Rows with SAS special missing values (.A-.Z,
._) in the HLO field are logged as incompatible entries and skipped
because R has no equivalent concept.
A named list of ks_format and ks_invalue objects that
were successfully imported. Returned invisibly.
# In SAS:
# proc format library=work cntlout=fmts; run;
# proc export data=fmts outfile="formats.csv" dbms=csv replace; run;
csv_file <- system.file("extdata", "test_cntlout.csv", package = "ksformat")
imported <- fimport(csv_file)
flist()
fprint()
fclear()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.