What is the difference between “keep” and “drop” statements in a SAS data step?

1 Answers
Answered by suresh

What is the difference between "keep" and "drop" statements in a SAS data step?

The Difference Between "Keep" and "Drop" Statements in a SAS Data Step

In a SAS data step, the "keep" statement is used to specify the variables that you want to include in the output dataset, while the "drop" statement is used to exclude specific variables from the output dataset.

The focus keyword here is SAS data step. When using the "keep" statement, only the variables mentioned in the statement will be retained in the resulting dataset, while all other variables will be dropped. On the other hand, when using the "drop" statement, the variables specified in the statement will be excluded from the resulting dataset, and all other variables will be retained.

By understanding the difference between "keep" and "drop" statements in a SAS data step, you can effectively control and manipulate the variables in your dataset to meet your specific analytical needs.

Answer for Question: What is the difference between “keep” and “drop” statements in a SAS data step?