BookmarkSubscribeRSS Feed
thanikondharish
Calcite | Level 5

proc report data=sashelp.class nowd;
columns name sex age height weight ;
define age/display ANALYSIS;
define height/display;
rbreak after/ summarize;
run;

 

WHAT IS THE USE OF ANALYSIS IN ABOVE DATA PROGRAM

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

See my answer to your related thread here.

Cynthia_sas
SAS Super FREQ

Hi:
As @PeterClemmensen recommending, reading the PROC REPORT documentation will help you here. You only need 1 usage usually, with a variable in a PROC REPORT DEFINE statement. So if you want age to be summarized on the RBREAK, then you need the usage of ANALYSIS (and you will get the default analysis statistic of SUM). However, if you want AGE not to be included in any grand total summary line, then a usage of DISPLAY is appropriate.

Now, getting a summary of all the ages or all the heights doesn't make sense, and in your code, if you run it, you'll see that AGE and WEIGHT are summarized at the RBREAK, but HEIGHT (because it is a usage of DISPLAY) is NOT summarized.

Asking for the MEAN or MIN or MAX on the summary line would be more likely on a report that showed every detail row. You can achieve this by changing the statistic on the DEFINE statement. Oh, wait, you don't have a statistics, so you are getting the DEFAULT of SUM for AGE and WEIGHT.

See what happens if you do this:

proc report data=sashelp.class nowd;
columns name sex age height weight ;
define age/min ANALYSIS;
define height/display;
define weight / analysis min;
rbreak after/ summarize;
run;



Cynthia

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!

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
  • 2 replies
  • 666 views
  • 0 likes
  • 3 in conversation