dbosak01/libr

Datastep stripping labels

Closed this issue · 0 comments

datastep with where, keep, and adding a variable strips any labels on original dataset.

# Create data
dat <- mtcars[1:3, 1:3]


# Assign labels
labels(dat) <- list(mpg = "Miles Per Gallon",
                    cyl = "Cylinders",
                    disp = "Displacement")

datastep(dat, keep = v(mpg, cyl),
         where = expression(cyl == 6),
         {
           
           cylc <- paste(cyl, "Cylinders")
         }) -> dat3