From the course: SAS Programming for R Users, Part 1

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Subsetting data

Subsetting data

- [Narrator] In this section, I want to show you how to use a data step to subset columns, or maybe subset rows, and finally subset observations conditionally to a new sas data set. Previously I showed you how to print the unique levels of specific variables, in this section I'll actually show you how to create a data set of those unique levels as well. And then you can go ahead and concatenate them together to create a data set which is basically like a list in this case, coming from R. I also want to show you how to subset conditionally, for example maybe I want to pull out all the observations in the cars data set where the origin is equal to Asia, and, also perhaps Europe, and then I can row bind those together to create a new sas data set. Thus far, I've been saying to specify the data set in the data statement and the set statement as the same. Again, that would overwrite the existing data table with the changes. So, to subset a new data set, I'll specify the data set I want to…

Contents