Create a new data set for each BY-Group in a data set


/ Published in: SAS
Save to your folder(s)

This sample uses macro logic to determine the number of unique values of a variable (the BY variable) and creates a new data set for each. The resulting data set names will be the BY variable value.

Limitations:

The sample code does not allow for BY values of longer than 32 positions, numeric BY values or BY values that contain characters that are not permitted in SAS data set names.

If your data contains any of the above, you must add program statements to convert your BY values into valid SAS data set names.

URL: http://jaredprins.squarespace.com/blog/2008/5/20/use-the-by-statement-to-create-a-new-data-set-for-each.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.