When I use order=internal, proc report is not working as expected--see the second piece of code. Any ideas? One issue may be that the format for the column I am ordering by has leading spaces.
*build custom format $indented.;
proc format cntlin=desktop.forformat; run;
options pageno=1;
proc report nofs headline headskip data=desktop.beadata;
column ('--' category series series=label value);
define category/group;
define series/group;
define label/group format=$indented.;
define value/ format=comma9.;
break after category/skip;
title3 'Correct order of series--Total employment CA25.0010 etc. is before the industry detail for employment';
run;
*Order=internal not producing expected results;
options pageno=1;
proc report nofs headline headskip data=desktop.beadata /* (where=(category='Employment')) */ ;
column ('--' category series value);
define category/group;
define series/group format=$indented. order=internal;
define value/ format=comma9.;
break after category/skip;
title3 'Order of series is not the internal order--total employment, etc. is after industry detail';
run;
title2;
*BTW, do not get this problem when just tabulate the emplotment numbers.
One problem could be duplicated formattted values--for example, CA25N.0400 and CA05N.0400 both format as ' Construction';
Hi:
The difference is party due to the fact that the format is applied BEFORE the grouping is done. So order=internal is giving unpredictable/undesirable results, as described in this Tech Support note: 8577 - Formats for ORDER, GROUP or ACROSS variables are applied prior togrouping
The fix is to use your #1 report and use NOPRINT on the DEFINE for SERIES, but then keep LABELon the report. Without LABEL on the second report there was no "unformatted" information for SERIES to be able to group the way you want.
cynthia
Hi:
The difference is party due to the fact that the format is applied BEFORE the grouping is done. So order=internal is giving unpredictable/undesirable results, as described in this Tech Support note: 8577 - Formats for ORDER, GROUP or ACROSS variables are applied prior togrouping
The fix is to use your #1 report and use NOPRINT on the DEFINE for SERIES, but then keep LABELon the report. Without LABEL on the second report there was no "unformatted" information for SERIES to be able to group the way you want.
cynthia
Cynthia:
Thanks of your quick reply. This all makes sense now.
BTW, this is a somewhat subtle point and would be a good thing to put in the proc report documentation.
--Adrian
Even after 27 years there's always a chance to improve the PROC REPORT doc. Here's a web page for submitting documentation feedback: Product Documentation Feedback
Thanks!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: