Reordering the Headings

The previous example hinted that there was a good reason to use ORDER=FORMATTED. The reason is that it lets you force a particular order in your class variable values. If you have a class variable where the values cannot be sorted into the correct order, you can use PROC FORMAT to give them new values that can be sorted into the right order. For example, suppose we want to build a table showing test scores from three courses: Reading, Writing, and Arithmetic, in exactly that order. Here is the code to produce the basic table of scores:
PROC FORMAT; VALUE COURSEFT 101='Writing' 104='Arithmetic' 109='Reading'; RUN; PROC TABULATE DATA=TEMP; CLASS COURSE GENDER; FORMAT COURSE COURSEFT.; VAR SCORE; TABLE COURSE*MEAN=' ', (GENDER=' ...

Get PROC TABULATE by Example, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.