Selecting Variables

Where to Specify DROP= and KEEP= Data Set Options

When match-merging, specify these options in either the DATA statement or the MERGE statement, depending on whether you want to reference the variables in that DATA step:
  • To reference a variable in the original data set (in a subsetting IF statement, for example) specify the variable in the DROP= option in the DATA statement. Otherwise, you might get unexpected results and your variable would be uninitialized.
    data clinic.merged (drop=id);
  • To not reference certain variables and exclude them from the new data set, specify them in the DROP= option in the MERGE statement.
    merge clinic.demog(in=indemog  
                      rename=(date=BirthDate))  
          clinic.visit(drop=weight in=invisit 
                      rename=(date=VisitDate));
When used in the DATA statement, the DROP= option simply drops the variables from the new data set. However, the variables are still read from the original data set and are available for processing within the DATA step.
Last updated: January 10, 2018
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.212.71