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 (October 2000, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 12 Oct 2000 16:38:38 -0400
Reply-To:     "EXT-Smith, Anne M" <Anne.Smith@PHL.BOEING.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "EXT-Smith, Anne M" <Anne.Smith@PHL.BOEING.COM>
Subject:      Re: leading zeros
Comments: To: "Deppman, Laurie M" <Laurie.Deppman@DOH.WA.GOV>
Content-Type: text/plain

Hi Laurie, Here's one possible solution that I have used to solve this variety of age range text problem myself. Break up the string using the dash as the delimiter and some functions like substr and scan, and then sort the result on the lower range number. This will work perfectly as long as the units for the ages are years. If you have days, months or years as possible units then you may need to do some conversions months-> years and so forth. Sorting will be alittle more difficult with mixed units, but conversions will do there. Kind regards, Anne .

> ---------- > From: Deppman, Laurie M[SMTP:Laurie.Deppman@DOH.WA.GOV] > Reply To: Deppman, Laurie M > Sent: Thursday, October 12, 2000 3:50 PM > To: SAS-L@LISTSERV.UGA.EDU > Subject: leading zeros > > I have a list of age groups like this: > > age > 0-4 > 5-9 > 10-14 > 15-19 > 20-24 > 25-29 > 30-34 > 35-39 > 40-44 > 45-49 > 50-54 > > When I sort them they end like this: > > age > 0-4 > 10-14 > 15-19 > 20-24 > 25-29 > 30-34 > 35-39 > 40-44 > 45-49 > 5-9 > 50-54 > > I tried adding a leading zero, but I keep getting this error message and > I'm > not sure why. Age is a character variable. Does anyone know why and/or > have another solution? > > 1032 data newx; > 1033 set pop.new; > 1034 agegrp = input(age,z5.1); > ---- > 228 > 1035 run; > > ERROR 228-185: Informat Z is unknown. > > Same error message: > > 1036 data newx; > 1037 set pop.new; > 1038 agegrp = right(input(age,z5.1)); > ---- > 228 > 1039 run; > > ERROR 228-185: Informat Z is unknown. >


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