BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AdrianGriffin
Obsidian | Level 7

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

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

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

AdrianGriffin
Obsidian | Level 7

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

Tim_SAS
Barite | Level 11

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!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1264 views
  • 0 likes
  • 3 in conversation