Working with grouped observationsWhat is a BY-group?Sometimes the data you work with will have observations arranged in groups by the values of one or more variables (the "BY variables"). A simple illustration of this would be a data set with variables A, B, C, D that looks like this: Example 1. A B C D
Importance of knowing how to work with grouped observationsKnowing how to work with grouped observations allows you to work with data at different levels. In addition, understanding BY-groups and the FIRST. and LAST. BY-variables explained below, will allow you to quickly test for the uniqueness of identifier variables in your data.
Applications
What you have to do
How the FIRST.byvariable and LAST.byvariable take on values in the PDV
Program examples of BY-group processing
Determining the uniqueness of an identifier variableWe will test for uniqueness of the identifier variable in a household level data set. Click here to see the data set and the program code to do this.
Creating a household level variable from person level dataUsing the same person level data set which you have seen earlier in this section, we will count, for each household, the number of persons less than 18 years of age. Click here to see the data set and the program code to do this.Another topic? Questions or comments? If you are affiliated to the Carolina Population Center, send them to Phil Bardsley; non-affiliates may contact the author Dan Blanchette.
|

