data sasuser.demog;
input subject race age sex $1. eth trt;
datalines;
1 2 6 M 2 1
2 4 0 M 4 2
3 1 33 F 1 1
4 2 38 F 2 2
5 4 2 F 4 1
;
run;
proc format library=sasuser;
value $age 0-17='<18'
18-29='18-29'
30-39='30-39'
40-49='40-49';
run;
options fmtsearch=(sasuser);
PROC TABULATE DATA=sasuser.demog out=sasuser.demog1(drop= _table_ _page_ _type_);
class trt age/preloadfmt;
format age age.;
table age, trt all/printmiss;
RUN;
By this code I am getting age numeric variable but with formatted values. I want the same dataset but that age varible as character variable and with the formatted values. Is it possible if so pls suggest the way?
just run a data step with the put statement to create a new variable with the formatted values
length age_band $10;
age_band =put(age,$age.);
Try specify discrete values for age (not intervals) in your format specification.
just run a data step with the put statement to create a new variable with the formatted values
length age_band $10;
age_band =put(age,$age.);
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.
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.