I need to sort the Academic Year descending. Since this is not a numeric variable, I decided to use the preloadfmt to make sure the table follows this format -> Ideal formatting
However, the preloadfmt is not working and is not showing any warning or error in the log. The only thing I see in the log is: "NOTE: Format $LOADE is already on the library WORK.FORMATS. NOTE: Format $LOADE has been output." I don't think this has something to do.
I get this as a result of the code below Result from the code below Any idea how I can get the ideal result?
/*This is the code I'm using:*/
proc format;
value $LOADE
'FT' = 'FT'
'PT' = 'PT';
value $LEVEL
'First time Freshmen' = '1st'
'Other Freshmen' = '1st'
'Sophomores' = '2nd'
'Juniors' = '3rd'
'Seniors' = '4rd';
value $Academic
'2023-24'='2023-24'
'2022-23'='2022-23'
'2021-22'='2021-22'
'2020-21'='2020-21'
'2019-20'='2019-20';
run;
proc tabulate data=step3;
TITLE1 "Hisotircal Enrollment by load and level";
where pmajr='SYST';
class Academic_Year load level_description / preloadfmt;
Table (Academic_Year*load), level_description all=total/ printmiss misstext='0';*/ norow nocol nopercent nocum;
format load $loade. Academic_Year $Academic. level_description $level.;
run;
In PROC FORMAT VALUE statememt use option
NOTSORTEDIn PROC TABULATE CLASS statement add option
ORDER=FORMATTEDTwo of the formats in your code can be removed because they are redundant and do not perform any transformation.
Example: