Import SAS macro source
Value
A sas_macro list with normalized path, UTF-8 source,
macro_names, and parameters character vectors.
Details
Metadata is extracted with regular expressions, not a complete SAS parser. Parameters are taken from the first matched macro declaration. The source is not executed or checked for SAS correctness.
Examples
path <- tempfile(fileext = ".sas")
writeLines("%macro derive_flag(input=, output=); %mend derive_flag;", path)
macro <- import_sas_macro(path)
macro$macro_names
#> [1] "derive_flag"
macro$parameters
#> [1] "input" "output"
unlink(path)