Skip to contents

SAS's &SYSINFO macro variable encodes the result of PROC COMPARE as a bitmask. ks_sysinfo() returns a compatible-style integer summarizing the same kinds of facts, plus a named integer vector showing which bits are set. Bit positions follow SAS documentation:

Usage

ks_sysinfo(x)

Arguments

x

A ks_comparison object.

Value

An integer with class ks_sysinfo. Use as.integer() for the raw value or print to see the named bits.

Details

BitMaskMeaning
11Data set labels differ
22Data set types differ
34Variable has different informat
48Variable has different format
516Variable has different length
632Variable has different label
764Base data set has observation not in compare
8128Compare data set has observation not in base
9256Base data set has BY group not in compare
10512Compare data set has BY group not in base
111024Base data set has variable not in compare
122048Compare data set has variable not in base
134096A value comparison was unequal
148192Conflicting variable types
1516384BY variables do not match
1632768Fatal error - comparison not done

Length and informat are not currently tracked; their bits are always clear. haven does not surface SAS informats, and column "length" is not a meaningful R-side concept for numerics.

Examples

a <- data.frame(id = 1:3, x = c(1, 2, 3))
b <- data.frame(id = 1:3, x = c(1, 2, 4), z = 1:3)
cmp <- ks_compare(a, b, by = "id")
#>  a vs b — 1 value diff across 1 column
ks_sysinfo(cmp)
#> 
#> ── SYSINFO = 6144 ──
#> 
#>  compare has variable not in base (2048)
#>  value comparison unequal (4096)
as.integer(ks_sysinfo(cmp))
#> [1] 6144
#> attr(,"bits")
#>              data set labels differ               data set types differ 
#>                                   0                                   0 
#>           variable informat differs             variable format differs 
#>                                   0                                   0 
#>             variable length differs              variable label differs 
#>                                   0                                   0 
#> base has observation not in compare compare has observation not in base 
#>                                   0                                   0 
#>    base has BY group not in compare    compare has BY group not in base 
#>                                   0                                   0 
#>    base has variable not in compare    compare has variable not in base 
#>                                   0                                2048 
#>            value comparison unequal          conflicting variable types 
#>                                4096                                   0 
#>           BY variables do not match                         fatal error 
#>                                   0                                   0