I don't know how to change my continous (yob) variable to discrete. I wanted the categories to look like this
2001-1984 (21-32)
1983-1973 (33-43)
1972-1962 (50-60)
1961-1951 (61-71)
proc format;
value yobf 1951-1962='61-71'
1962-1972='50-60'
1973-1983='33-43'
1984-2001='21-32';
run;
Then in a data step or PROC, you assign the format to the variable.
format yob yobf.;
Can you elaborate more
proc format;
value msrpf 0-25000='0-25K' 25000<-50000='25K-50K' 50000<-high='>50K';
run;
proc print data=sashelp.cars(obs=15);
var make model msrp;
format msrp msrpf.;
run;
Just want to add a note that, FORMAT only changes how MSRP looks, not the real values of MSRP. So MSRP is still a numeric variable, not a discrete or categorical variable.
Why do you want to discretize a continuous variable, other than to throw away valuable information? See Regression Modeling Strategies, By Frank Harrell for reasons to avoid doing this.
SteveDenham
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.