4

24660 - Using an index for BY processing instead of sorting

 2 years ago
source link: http://support.sas.com/kb/24/660.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Sample 24660: Using an index for BY processing instead of sorting

Create and use an index for BY-group processing when sorting is not possible or practical.

Note:   If you have a single variable on the BY statement, use a simple index. If you have multiple variables in the BY-group, you can use a simple index on the first variable in the BY-group, or you can use a composite index built on the variables on the BY statement in the same order. A composite index does not have to contain all the variables in the BY-group, but at a minimum the first variable of the BY-group must be the same as the first variable in the index. Additional variables in the composite index should match the order of the variables in the BY-group for best performance. If there are multiple BY variables and the composite index does not include all of them, the unnamed variables must be in sorted order or the BY process will fail.

System performance will not be as good as using a sorted data set, but it will allow you to use a BY statement without having a sorted data set.


These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK