Date: Thu, 12 Oct 2000 20:17:24 GMT
Reply-To: Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Paul Dorfman <paul_dorfman@HOTMAIL.COM>
Subject: Re: leading zeros
Content-Type: text/plain; format=flowed
Laurie,
Instead of adding a leading zero, move the entire value to the right within
the variable's AGE expression length. This way, the values will be led by
blanks and sort as desired:
data a;
input age $;
age = right(age);
cards;
0-4
5-9
10-14
15-19
20-24
25-29
30-34
35-39
40-44
45-49
50-54
;
run;
proc sort; by age; run;
Kind regards,
=====================
Paul M. Dorfman
Jacksonville, Fl
=====================
>From: "Deppman, Laurie M" <Laurie.Deppman@DOH.WA.GOV>
>
>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.
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
|