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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.