A queryable view over sas_r_map, the shipped SAS-to-R equivalence table: SAS macro or PROC idiom -> the R call that replaces it -> one line on where the two behave differently. Called with no arguments it returns the whole table; fn filters by R function, sas by SAS idiom, and both together intersect.

parity_note(fn = NULL, sas = NULL, ...)

Arguments

fn

Optional R function name. Matched exactly against the sasparity_fn column (e.g. "tab_ae_soc") and as a fixed substring against r_function (e.g. "count_occurrences", "dplyr::").

sas

Optional SAS idiom, matched case-insensitively as a regular expression against sas_idiom and sas_equivalent (e.g. "PROC FREQ", "nodupkey", "^%").

...

Unused; present so a mistyped filter name errors instead of being silently ignored.

Value

A tibble::tibble(): the matching rows of sas_r_map, with its eight columns. Errors rather than returning zero rows when a filter matches nothing.

Details

The rows for this package's own displays (topic == "display") carry the same sas_equivalent text that each function's @section SAS equivalent block shows and that every returned object exposes as $sas_equivalent, so parity_note() is the one place to look it up without calling the function first.

Examples

parity_note()
#> # A tibble: 51 × 8
#>    topic sas_idiom sas_equivalent r_function difference sasparity_fn phuse_files
#>    <chr> <chr>     <chr>          <chr>      <chr>      <chr>              <int>
#>  1 disp… %aebodsy… %aebodsys mac… sasparity… "The PHUS… tab_ae_soc             9
#>  2 disp… %aelist … %aelist macro… sasparity… "PROC REP… lst_ae                 4
#>  3 disp… %aesev /… %aesev macro … sasparity… "SAS deci… tab_ae_seve…           3
#>  4 disp… %aesumm … %aesumm macro… sasparity… "tern::co… tab_ae_summ…           1
#>  5 disp… %demog /… %demog macro … sasparity… "PROC FRE… tab_demogra…           2
#>  6 disp… %disposi… %disposition … sasparity… "PROC FRE… tab_disposi…           1
#>  7 coun… _N_ / mo… _N_ (DATA ste… dplyr::ro… "_N_ coun… NA                    19
#>  8 coun… DATA ste… DATA step FIR… dplyr::gr… "FIRST./L… NA                    34
#>  9 coun… PROC FRE… PROC FREQ TAB… dplyr::co… "PROC FRE… NA                    20
#> 10 coun… PROC SOR… PROC SORT NOD… dplyr::di… "NODUPKEY… NA                     9
#> # ℹ 41 more rows
#> # ℹ 1 more variable: phuse_example <chr>
parity_note("tab_ae_soc")$sas_equivalent
#> [1] "%aebodsys macro / PROC FREQ by AEBODSYS*AEDECOD with first.usubjid dedup (Table 14.3.2 AEs by SOC and PT)"
parity_note(sas = "PROC FREQ")[c("sas_idiom", "r_function")]
#> # A tibble: 6 × 2
#>   sas_idiom                                            r_function               
#>   <chr>                                                <chr>                    
#> 1 %aebodsys / PROC FREQ AEBODSYS*AEDECOD               sasparity::tab_ae_soc()  
#> 2 %aesev / PROC FREQ AEBODSYS*AEDECOD*ASEV worst grade sasparity::tab_ae_severi…
#> 3 %aesumm / PROC FREQ AE overview counts               sasparity::tab_ae_summar…
#> 4 %demog / PROC MEANS + PROC FREQ by treatment         sasparity::tab_demograph…
#> 5 %disposition / PROC FREQ on EOSSTT                   sasparity::tab_dispositi…
#> 6 PROC FREQ TABLES a*b                                 dplyr::count() / tern::c…
# the difference column is the valuable one
parity_note(sas = "nodupkey")$difference
#> [1] "NODUPKEY sorts first, keeps the first record per key and can write the rest to DUPOUT= for review; distinct() keeps the first row in the current row order and discards the duplicates with no record of what was dropped."