BookmarkSubscribeRSS Feed
SAS_new
Calcite | Level 5

Hi-

Can anyone help me with multiple compute statements within Proc Report?   I cant seem to get it to work:

I am looking to compute the sum of FCODE within RACE by school.   Thank you all!

PROC REPORT NOWD DATA=Q1 OUT=Q1A

NOFS HEADLINE HEADSKIP;

COLUMNS SCHOOLcODE RACE FCODE TOTAL;

DEFINE SCHOOLCODE / GROUP;

DEFINE RACE / DISPLAY;

DEFINE FCODE / DISPLAY;

DEFINE TOTAL/ ANALYSIS SUM;

COMPUTE AFTER SCHOOLCODE;

ENDCOMP;

BREAK AFTER SCHOOLCODE / SUMMARIZE  ;

RUN;

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  What are you trying to get to work? You have nothing in your COMPUTE block for SCHOOLCODE. I have already posted a response in your other question, that RACE needs to be ORDER or GROUP if you want to get a summary on it. If all you want is a summary line, you do not need a COMPUTE block, only a BREAK statement.

  Also, I have a hard time visualizing what you want when you say that you want "sum of FCODE within RACE by school" -- do you want to see 1 summary row for every unique combination of SCHOOL/RACE/FCODE? or do you want to see each SCHOOL with the detail lines for RACE/FCODE and then have a summary at the end of the DETAIL lines.

  I'd recommend that you study the documentation topic on ow PROC REPORT builds a report so you can understand the function of GROUP and ORDER with BREAK and COMPUTE.

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!

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
  • 1 reply
  • 673 views
  • 0 likes
  • 2 in conversation