I am new to using PROC REPORT and do not fully understand how the sorting works. My code is as follows (substituted with dummy variables):
proc report data = working nowd split = '*'
%reportStyle;
column VAR TIME _STAT_ CAT1 CAT2 CAT3;
define VAR / order 'Variable' order = data style(column) = [just = left cellwidth = 0.7in];
define TIME / order 'Subvariable' order = data style(column) =...;
define _STAT_ / display 'Statistics' format = stat. style(column) = ...;
define CAT1 / display 'CAT1' ...;
define CAT2 / display 'CAT2' ...;
define CAT3 / display 'CAT3' ...;
compute after;
line "Footnote";
endcomp;
run;
I want it to first sort by Subvariable and then by Variable, while maintaining my desired order of columns.
Thank you in advance.
Introduce an extra copy of the second column as a hidden zero-th column to sort by.
proc report data=sashelp.class ;
column sex=extra name sex age ;
define extra / order noprint;
define name / order ;
define sex / order;
define age / display;
run;
Introduce an extra copy of the second column as a hidden zero-th column to sort by.
proc report data=sashelp.class ;
column sex=extra name sex age ;
define extra / order noprint;
define name / order ;
define sex / order;
define age / display;
run;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.