SAS : combined group code and concatenated name
We also use the sashelp.baseball dataset as a sample data which was used in the previous post below.
We assume that work.base2 dataset is prepared, which is already created in the previous post.
Grouping based on all enumerations of key columns
The following SAS code makes a set of group number (grno), code (grcd), and name (grnm) based on all enumerations of key columns such as League, Division, and Team.
The above code produces the combined group information(no, code, name) which we intend to make.
Grouping based on specific conditions of key columns
The following SAS code generates a set of group number (grno), code (grcd), and name (grnm) based on some user-defined conditions of key columns such as League, Division, and Team.
We can find that the above code delivers the following grouped information which is filtered by some conditions.
Difference between two groupings
To find the differences between two grouping methods, let's calculate group-by averages.
As expected, averages of log salary are calculated by each groups as follows.
These grouping methods are mainly used for repeated regressions by group such as pool-level regressions.
Period.
No comments:
Post a Comment