Help using Base SAS procedures

You can only BREAK on GROUPing or ORDERing variables when doing PROC REPORT

Reply
Frequent Contributor
Posts: 77

You can only BREAK on GROUPing or ORDERing variables when doing PROC REPORT

 

 

 

Im learning PROC REPORT by following guides that i found on google.

However, i got this error when i try doing it:

You can only BREAK on GROUPing or ORDERing variables

 

with the code below:

 

 

proc report data=ALFRED.shoes;
COL Name Age Country Nationality Agemean;
DEFINE Age /analysis mean;
DEFINE Country /DISPLAY 'Country of Origin';
DEFINE Agemean /COMPUTED 'Age Mean';
COMPUTE Agemean;
Agemean=Age.mean;
ENDCOMP;
BREAK AFTER Nationality / SUMMARIZE;
run;

 

I read alot of guides about BREAK AFTER, and im still very confused about the purpose and usage of it. Can anyone explain this in a simpler way?

Super Contributor
Posts: 490

Re: You can only BREAK on GROUPing or ORDERing variables when doing PROC REPORT

Posted in reply to imdickson
proc report data=ALFRED.shoes;
COL Name Age Country Nationality Agemean;
DEFINE Nationality /order;
DEFINE Age /analysis mean;
DEFINE Country /DISPLAY 'Country of Origin';
DEFINE Agemean /COMPUTED 'Age Mean';
COMPUTE Agemean;
Agemean=Age.mean;
ENDCOMP;
BREAK AFTER Nationality / SUMMARIZE;
run;
Super User
Super User
Posts: 7,997

Re: You can only BREAK on GROUPing or ORDERing variables when doing PROC REPORT

Posted in reply to imdickson

Hi,

 

Just to add two things there, you can define the variable as either group or order depending on wht you are doing.  A further note is that code formatting makes things a lot easier to read - consistent capitilisation indetations etc. as in (and you can use the {i} icon above the post to add code):

proc report data=alfred.shoes;
  columns name age country nationality agemean;
  define name         / display 'Name';
  define age          / analysis mean;
  define country      / display 'Country of Origin';
  define nationality  / group 'Nationality';  /* Or order */
  define agemean      / computed 'Age Mean';

  compute agemean;
    agemean=age.mean;
  endcomp;

  break after nationality / summarize;
run;
Ask a Question
Discussion stats
  • 2 replies
  • 862 views
  • 2 likes
  • 3 in conversation