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.);
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.