Patrick
one big reason I go to SASGF is the access to people who make SAS what it is!
In SASGF in April this year the man who makes the formats was presenting a glimpse of syntax a little similar to what Andrew0845 posted. Rick demonstrated using regular expression syntax in an informat to parse strings in the magic way of perl regular expressions. He has been working on it for a few years so it is good to hear that it will finally be delivered in SAS9.3 (some time soon, qtr3 2011, maybe 😉
Hence my earlier posting suggesting that regular expressions might have been behind the origins of "([0-9])".
However,
1-<([0-9])3='00 Youth'
13-<([0-9])0='00 Teen'
20-<([0-9])0='00 Adult'
70-high='000 Senior';
looks more like a weak effort to achieve the ranges in the following test
proc format ;
picture agedesc (round)
1-<13='00 Youth'
13-<20='00 Teen'
20-<70='00 Adult'
70-high='000 Senior';
run ;
%put %sysfunc( putn( 13, agedesc )) %sysfunc( putn( 103, agedesc ));
produces the logline
13 Teen 103 Senior
Interestingly, as these ranges are simply consecutive, PROC FORMAT would assume the choice Andrew's predecessor was enforcing - where consecutive ranges coincide on a value, assume it belongs to the upper range.
picture agede5c
1-13='00 Youth'
13-20='00 Teen'
20-70='00 Adult'
70-high='000 Senior';
achieves the same effect
data demo ;
do age= 0 to 3, 11.5 to 14 by 3, 18 to 22 by .4, 68 to 72 by .6, 99 to 102 by .7;
put age= age agedesc. age agede5c. ;
end;
stop ;
run;
produced these log lines[pre]age=0 0 0
age=1 1 Youth 1 Youth
age=2 2 Youth 2 Youth
age=3 3 Youth 3 Youth
age=11.5 12 Youth 11 Youth
age=18 18 Teen 18 Teen
age=18.4 18 Teen 18 Teen
age=18.8 19 Teen 18 Teen
age=19.2 19 Teen 19 Teen
age=19.6 20 Teen 19 Teen
age=20 20 Teen 20 Teen
age=20.4 20 Adult 20 Adult
age=20.8 21 Adult 20 Adult
age=21.2 21 Adult 21 Adult
age=21.6 22 Adult 21 Adult
age=22 22 Adult 22 Adult
age=68 68 Adult 68 Adult
age=68.6 69 Adult 68 Adult
age=69.2 69 Adult 69 Adult
age=69.8 70 Adult 69 Adult
age=70.4 70 Senior 70 Senior
age=71 71 Senior 71 Senior
age=71.6 72 Senior 71 Senior
age=99 99 Senior 99 Senior
age=99.7 100 Senior 99 Senior
age=100.4 100 Senior100 Senior
age=101.1 101 Senior101 Senior
age=101.8 102 Senior101 Senior[/pre]
peterC