Is following allowed? looks ok, but 4 is defined twice in format, the result is using homie, not mid.
Can someone help explain?
proc format;
value ne
low - 4 = 'homie'
4 - 8 = 'mid';
run;
data t;
input amt;
cards;
4
5
;
proc print data=t;
format amt ne.;
run;
I thought Mid will be displayed in the place of 4.
Because 4-8='mid' is the recent value in proc format.
So this is going to apply to "4"..
Regards..
Sanjeev.k
The best response is to submit yours statements and consult the ouptut...
Another idea... submit these 2 statements
format cntlout=poub ;run;
print label ;var fmtname start end sexcl eexcl;run;
Ouptut
Ending
Format Starting value value for Start End
name for format format exclusion exclusion
NE LOW 4 N N
NE 4 8 Y N
Without testing I would have expected that an error gets thrown because of overlapping ranges. But no: Proc Format digests these overlapping values.
On my SAS9.3 Win64 installation the label from the lower range is taken independently in what order the ranges are defined with Proc Format (so it's always 'homie').
Wouldn't have thought about writing the format to a data set like RLC did. It's quite nice as it actually gives you an idea of what Proc Format does to deal with such an ambiguity.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.