LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (August 2000, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 15 Aug 2000 08:44:24 -0400
Reply-To:     Bill <bill.leblanc@CELEBRATION.FL.US>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Bill <bill.leblanc@CELEBRATION.FL.US>
Subject:      omit column in proc tabulate
Comments: To: "Sas-L, Sas-L" <SAS-L@UGA.CC.UGA.EDU>
Content-Type: multipart/alternative;

I would like to display some frequency data using proc tabulate, but with a little twist. I'd like to concatenate class variables, and for some of them, I'd like to omit the display of some levels without omitting the entire observation. An example will make this clear:

**how to show all males/females, but only the lefties in a tabulate table; data lefty; infile cards missover; input campus $ sex $ hand $; cards; E M L E M R E M L E M R E F L E F L E F R E F L W M R W F R W M L W M L W M L W F R W F L ; proc tabulate; class campus sex hand; tables campus, all = 'Total' * F = 5.0 (sex hand ) * (n='N' * f = 5.0 pctn<sex hand all> = '%' * f = 5.1 )/rts=10; run;

produces: ---------------------------------------------------------------- | | | sex | hand | | | |-----------------------+-----------------------| | |Total| F | M | L | R | | |-----+-----------+-----------+-----------+-----------| | | N | N | % | N | % | N | % | N | % | |--------+-----+-----+-----+-----+-----+-----+-----+-----+-----| |campus | | | | | | | | | | |--------| | | | | | | | | | |E | 8| 4| 50.0| 4| 50.0| 5| 62.5| 3| 37.5| |--------+-----+-----+-----+-----+-----+-----+-----+-----+-----| |W | 7| 3| 42.9| 4| 57.1| 4| 57.1| 3| 42.9| ----------------------------------------------------------------

I would like to keep the 15 subjects for some of the column variables (in this case 'sex'), but eliminate some subjects for other column variables (in this case the 6 right-handers), so that my table looks like:

---------------------------------------------------- | | | sex | hand | | | |-----------------------+------------ | |Total| F | M | L | | |-----+-----------+-----------+-----------+ | | N | N | % | N | % | N | % | |--------+-----+-----+-----+-----+-----+-----+-----+ |campus | | | | | | | | |--------| | | | | | | | |E | 8| 4| 50.0| 4| 50.0| 5| 62.5| |--------+-----+-----+-----+-----+-----+-----+-----+ |W | 7| 3| 42.9| 4| 57.1| 4| 57.1| ----------------------------------------------------

All percents would be based on the total row N's of 8 and 7.

Subsetting on the lefthanders, or deleting the 'R' values and using the 'missing' option does not give me what I need. In the case of the former, I'll lose 6 males and females, and in the case of the latter, I'll have N and % columns for the missings, which is what I want to supress.

The extension of this would be to tack on more column variables, eg, Race showing only the privileged, Religion showing only the chosen, etc, while still being able to display all levels for all subjects in other variables.

TIA,

Bill LeBlanc Institutional Research Valencia Community College


[text/html]


Back to: Top of message | Previous page | Main SAS-L page