Simple Proc Print trick for grouped data


Here's a Proc Print trick for grouped data.

Suppose your data is divided into groups, such as males and females.

You could sort by the grouping variable before printing, like this:

Proc Print trick for grouped data

Proc Print trick for grouped data

Suppose you want to better emphasize the groups. You could add a BY statement, like this:

Proc Print trick for grouped data

OK, but, personally, I prefer a different look.

Here's a trick. Add an ID statement, like this:

I like the above look, but that's just me.

Isn't it great that SAS gives us choices?!

Want to learn more great tips like these? Consider taking a course in our SAS programming learning path.


About Author

Jim Simon

Principal Technical Training Consultant

Jim Simon is a principal instructor and course developer for SAS Education. Jim has a bachelor's degree from UCLA and a master's degree from California State University at Northridge. Prior to joining the SAS Irvine office in 1988, Jim was an instructor at Ventura College and a SAS programmer at The Medstat Group in Santa Barbara. Jim's areas of specialization include the DATA step, application development, web enablement, and the SAS macro language. A native of Southern California, Jim enjoys anything in the warm California sun. On weekends, Jim loves jumping in his Corvette, turning up the stereo, and cruising Pacific Coast Highway, top down, South to Laguna Beach or North to his old home town, Santa Barbara.

Related Posts


Back to Top