The SAS Output Delivery System and reporting techniques

Proc report--order=internal not giving expected results

Accepted Solution Solved
Reply
Contributor
Posts: 27
Accepted Solution

Proc report--order=internal not giving expected results

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';

Attachment
Attachment

Accepted Solutions
Solution
‎04-25-2013 07:50 PM
SAS Super FREQ
Posts: 8,645

Re: Proc report--order=internal not giving expected results

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

View solution in original post


All Replies
Solution
‎04-25-2013 07:50 PM
SAS Super FREQ
Posts: 8,645

Re: Proc report--order=internal not giving expected results

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

Contributor
Posts: 27

Re: Proc report--order=internal not giving expected results

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

Super Contributor
Posts: 394

Re: Proc report--order=internal not giving expected results

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!

Post a Question
Discussion Stats
  • 3 replies
  • 178 views
  • 0 likes
  • 3 in conversation