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 (January 2004, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 15 Jan 2004 17:32:02 GMT
Reply-To:     julierog@ix.netcom.com
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Roger Lustig <trovato@VERIZON.NET>
Subject:      Re: Proc Tabulate
Content-Type: text/plain; charset=us-ascii; format=flowed

Dear Sharon:

Getting two different treatments of missing values for one variable in one PROC is difficult. Here's my lazy way out.

data new2/view=new2; set new; length sex2 $1; if sex=' ' then sex2='X'; else sex2=sex; run;

proc format; value $sex2fmt 'F'='Fem' 'M'='Male' 'X'='Unk' ; run;

PROC TABULATE DATA=new2 ; *** Removed the MISSING option; CLASS COUNTY / style={ font_size=.25}; CLASS RACE/ style={font_size=.25} preloadfmt; class SEX sex2/ style={font_size=.25} preloadfmt; var case; TABLE COUNTY=''(ALL='TOTAL'*f=6.), ( race=''*sex='' all='Total'*sex2='' ) *( case=''*(sum='')*f=6. )

/ RTS=25 BOX ='County' printmiss; FORMAT SEX $SEXFMT. sex2 $sex2fmt. RACE Racefmt. DISEASE $disfmt.; LABEL COUNTY='COUNTY'; RUN;

OK?

Roger Clanton, Sharon wrote:

> I have inherited a program which uses PROC TABULATE and need to make a > modification. Since I am not strong in using this procedure, I am > having a hard time figuring this one out. The table has columns by race > with subcolumns of sex. The problem is that they want a TOTAL column > which has Male, Female, AND Unknown sex, but they don't want the Unknown > sex column showing up in the race-specific columns. Everything I have > tried puts Unknown in every race category. Does anyone know a trick to > tell SAS not to print a specific level? I may have to use another > approach instead of Tabulate, but before I redo this, I thought I would > ask the "experts". I am using v8.2 on Windows 2000. I am listing the > code I was given below and an arrangment example, I just don't know if > the example will stay lined up correctly when I send it out. > > PROC TABULATE DATA=new missing ; > CLASS COUNTY / style={ font_size=.25}; > CLASS RACE/ style={font_size=.25} preloadfmt; > class SEX / style={font_size=.25} preloadfmt; > var case; > TABLE > COUNTY=''(ALL='TOTAL'*f=6.),race=''*sex=''*(case=''*(sum='')*f=6.) > > (ALL='Total'*f=6.)*SEX=''*(case=''*(sum='')) / > RTS=25 BOX ='County' > printmiss; > FORMAT SEX $SEXFMT. RACE Racefmt. DISEASE $disfmt.; > LABEL COUNTY='COUNTY'; > RUN; > > Table will look like: > County White Black Total > Male Fem Male Fem Male Fem Unk > > > Sharon Clanton > CDC NCHSTP/DSTD/SDMB > stc1@cdc.gov > (404) 639-8350


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