Example 8.1 Performing a Simple Subset 182
Example 8.2 Separating Unique Observations from Duplicate Observations Based on BY Values 185
Example 8.3 Separating Completely Duplicate Observations from Unique Observations 187
Example 8.5 Accessing a Specific Number of Observations from the Beginning and End of a Data Set 193
Example 8.6 Creating a Customized Sort Order without Adding a New Column to the Table 196
Example 8.7 Adding New Observations to the End of a Data Set 199
Example 8.8 Adding Observations to a Data Set Based on the Value of a Variable 201
Example 8.11 Expanding Single Observations into Multiple Observations 211
Example 8.12 Collapsing Observations within a BY Group into a Single Observation 215
Example 8.13 Obtaining the Previous Value of a Variable within a BY Group 220
Example 8.14 Comparing the Value of a Variable to Its Value in the Next Observation 225
Example 8.15 Applying the Same Operation to a Group of Variables 227
The examples in this chapter work with a single data set or table. They show several techniques of rearranging the contents of your data set by using DATA step statements, SAS procedures, and PROC SQL features. The last example shows how to work with generation data sets.
The examples include techniques for transposing observations into variables and variables into observations, finding duplicate and unique observations in a data set, adding observations at specific locations to a data set, and obtaining variable values from preceding or succeeding observations.
Some of the examples are similar to ones already presented in that the program performs a merge or join, but in this chapter a single data set is merged or joined with itself.
3.149.244.14