Hi everybody, I have a question regarding ORDER=FORMATTED: If no format is applied, the BEST12. format is used for numeric variables. However, I haven't found any description for categorical variables.
I tested using sashelp.cars dataset. It seems like the order is the same as the result of order=internal. So my question is if no format is specified for order=formatted, does SAS use order=internal instead?
proc report data=sashelp.cars(OBS=30);
Column Type invoice ;
define type/order order=formatted;
run;
proc report data=sashelp.cars(OBS=30);
Column Type invoice ;
define type/order order=internal;
run;
Thanks for your help in advance! Any thoughts would be appreciated!
If there is no format associated, the value is used, which is what option internal does.
Thanks so much for confirming!
If by "categorical" you mean Character then the format will be $W. Which will generally mean your national language sort setting. Note that you may get some things that appear out of order if they have leading spaces because the sort will use the space for determining order but the display in many procedures will not display the leading space.
Numerical variables can be used as categorical. Custom formats to create groups of values, such as 10-year intervals for age, can turn continuous values into categorical values for most analysis, reporting graphing procedures.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.