I tried searching for an answer on this topic but couldn't find a definitive answer. Shouldn't the following code generate an error message? The groupings overlap. How would SAS decide where to put a value of "2" based on these groupings?
26 proc format;
27
27 ! value test
28 1-2='1-2'
29 2-3='2-3'
30 ;
NOTE: Format TEST has been output.
31 run;
NOTE: PROCEDURE FORMAT used (Total process time):
real time 0.05 seconds
cpu time 0.03 seconds
No it won't generate an error and it won't assign multiples, it uses the first instance or assume that's it's included.
You can control the boundaries using < to explicitly include or exclude.
proc format;
value test
1-<2 = '1-2'
2-3 = '2-3';
run;
data sample;
do i=1 to 4;
format i test.;
output;
end;
run;
No it won't generate an error and it won't assign multiples, it uses the first instance or assume that's it's included.
You can control the boundaries using < to explicitly include or exclude.
proc format;
value test
1-<2 = '1-2'
2-3 = '2-3';
run;
data sample;
do i=1 to 4;
format i test.;
output;
end;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.