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.);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.