in case bncoxuk wanted to "recode" using a format:
/* a test dataset */
data one;
a=18; b=19; output;
a=15; b=24; output;
run;
/* recoding using a format */
proc format;
value level
0-< 5 = 1
5-<10 = 2
10-<15 = 3
15-<20 = 4
20-<25 = 5
other = .;
run;
/* recoding */
data two;
set one;
a = input(put(a, level.), best.);
b = input(put(b, level.), best.);
run;
/* check */
proc print data=two;
run;
/* on lst
Obs a b
1 4 4
2 4 5
*/
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 the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.