sasSubstr: sasSubstr

View source: R/sasWhereConstructors.R

sasSubstrR Documentation

sasSubstr

Description

Helper function to construct a SAS 'where' statement to search through substrings in a SAS dataset via importSAS

Usage

sasSubstr(str.vec, target.var)

Arguments

str.vec

Character vector where each element is the start of the substring that should be searched for. Fx. c("DI05", "DI06) will search for any recrods that start with DI05 or DI06.

target.var

Character name of the variable in the SAS dataset that is to be searched

Details

The function allows a user to search for strings matching those in 'str.vec' in SAS datasets. Fx it can be used to find records in the LPR that match an ICD code

Value

Returns a string that can be passed to the "where" arguments of importSAS, or combined with other conditions in sasWhereConstructor

Author(s)

Matthew Phelps <mphelps@hjerteforeningen.dk>

See Also

importSAS

Examples

library(heaven)
x <- c("DI05", "DI06")
sasSubstr(x, target.var="A")



tagteam/heaven documentation built on Oct. 24, 2024, 7:40 p.m.