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 (November 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Nov 2010 16:14:58 -0800
Reply-To:     "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Nordlund, Dan (DSHS/RDA)" <NordlDJ@DSHS.WA.GOV>
Subject:      Re: Why doesn't the format hold?
Comments: To: Arthur Tabachneck <art297@ROGERS.COM>
In-Reply-To:  <201011092351.oA9NK28D022494@willow.cc.uga.edu>
Content-Type: text/plain; charset=utf-8

> -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > Arthur Tabachneck > Sent: Tuesday, November 09, 2010 3:51 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Why doesn't the format hold? > > It's probably just been too long of a day but, in running some code to > test a possible response to another thread, I came across the following > discrepancy that I don't understand. > > Given this set of code: > > data have ; > input @1 var1 $1. > @3 var2 $1. > @5 var3 $1. > @7 var4 $1. > @9 var5 $1.; > datalines; > 1 2 3 Y 5 > 2 3 A N 6 > 3 4 5 7 > 8 9 0 1 > ; > > proc format; > value $testnum > ' ','0','1','2','3','4','5','6','7','8','9'='9' > other='x'; > run; > > proc freq data=have; > format var2 $testnum.; > tables var2; > run; >

Art,

I see Joe has pointed you in one direction. If you truly want to group the missing with the digits, formatted as '9', and others formatted as 'x', you can. Just leave your format as it was originally, and add the missing option to your table statement.

proc format; value $testnum ' ','0','1','2','3','4','5','6','7','8','9'='9' other='x'; run;

proc freq data=have; format var4 $testnum.; tables var4 / missing; run;

Hope this is helpful,

Dan

Daniel J. Nordlund Washington State Department of Social and Health Services Planning, Performance, and Accountability Research and Data Analysis Division Olympia, WA 98504-5204


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