BookmarkSubscribeRSS Feed
imdickson
Quartz | Level 8

 

 

 

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?

3 REPLIES 3
mohamed_zaki
Barite | Level 11
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;
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;
himself
Quartz | Level 8
The variable listed on the BREAK statement is not defined as GROUP or
ORDER.


Solution:
Remove the BREAK statement or change the usage on the DEFINE
statement of that variable to GROUP or ORDER.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 6586 views
  • 2 likes
  • 4 in conversation