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 (July 2010, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 21 Jul 2010 09:36:41 -0400
Reply-To:     Chang Chung <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Chang Chung <chang_y_chung@HOTMAIL.COM>
Subject:      Re: Aaargh fomat/informat :-(
Comments: To: Laughing Beggar <laughing_beggar@HOTMAIL.COM>

On Wed, 21 Jul 2010 06:54:06 +0000, Laughing Beggar <laughing_beggar@HOTMAIL.COM> wrote: ... >I have a character variable called sex that is variously coded 'M' or 'm' or 'F' or 'f' and I want it to appear in a Proc Freq table as 'Male' and 'Female'. >I thought I'd try doing it with a format or an informat but have fully failed. >Can it be done this way? ... Hi, Mr. beggar: Here is one way. Keep laughing! :-) Cheers, Chang

/* test data */ data one; input id sex $ @@; cards; 1 M 2 m 3 F 4 f 5 f ; run;

proc format; value $sex 'M','m' = 'Male' 'F','f' = 'Female'; run;

proc freq data=one; tables sex; format sex $sex.; run; /* on lst The FREQ Procedure Cumulative Cumulative sex Frequency Percent Frequency Percent ----------------------------------------------------------- Female 3 60.00 3 60.00 Male 2 40.00 5 100.00 */


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