Dear community, I am trying to collapse median, q1 and q3 for an analysis variable to have them displayed in one cell in the final report. It works as long as I use only group variables, as soon as I switch to across variables I get an error: ERROR: The variable type of 'MSRP.MEDIAN'n is invalid in this context. So this works: proc report data=sashelp.cars;
columns Origin Make Type msrp msrp=msrpq1 msrp=msrpq3 stats;
define Origin /" " group;
define Make /" " group;
define Type / " " group;
define msrp / analysis median noprint;
define msrpq1 / analysis q1 noprint;
define msrpq3 / analysis q3 noprint;
define stats / computed;
compute stats / character length=50;
stats = catt(put(msrp.median, dollar7.1-l), " (", put(msrpq1, dollar7.1-l), "-", put(msrpq3, dollar7.1-l), ")");
endcomp;
run; But this does not: proc report data=sashelp.cars;
columns Origin Make Type msrp msrp=msrpq1 msrp=msrpq3 stats;
define Origin /" " group;
define Make /" " group;
define Type / " " group;
define msrp / analysis median noprint;
define msrpq1 / analysis q1 noprint;
define msrpq3 / analysis q3 noprint;
define stats / computed;
compute stats / character length=50;
stats = catt(put(msrp.median, dollar7.1-l), " (", put(msrpq1, dollar7.1-l), "-", put(msrpq3, dollar7.1-l), ")");
endcomp;
run; Ultimately I would like to obtain a table similar to one generated by below code, but with median, q1 and q3 collapsed into one computed variable: proc report data=sashelp.cars;
columns Origin Make Type, msrp, (n median q1 q3);
define Origin /" " group;
define Make /" " group;
define Type / " " across;
define n / format=2.;
run; What am I missing? Thanks!
... View more