BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am a SAS beginner.
I have a SAS data table with columns:

Identity (X?....?)
Gender (1,2)
Class (1,2)
Mark (1,2,3,4,5)

Variable Mark is numeric, the remaining of character type.

I want to create a summary report with PROC REPORT.

On the first line I would like to have the table total numbers for men(1), women(2) and total.
On the third line Class 1 numbers.
On lines 4-8 the number of individuals in Class 1 with different marks.

On lines 10-15 Class 2 in the same way as Class 1.


If I could get some help I would be most grateful.
Best regards
Anne
4 REPLIES 4
Cynthia_sas
Diamond | Level 26
Hi:
I don't understand what you mean by "class 1 numbers on third line" the rest of the description is clear.

cynthia
deleted_user
Not applicable
Cynthia,

I meant the sum of individuals (the number of individuals) in Class 1.

Bad english by me. Where I come from we talk rotvälska all the time.

Anne
prholland
Fluorite | Level 6
Anne,

Is this what you are looking for?

PROC REPORT DATA=table NOWD;
COLUMNS class identity mark gender,(N) overall;
DEFINE class / GROUP;
DEFINE identity / GROUP;
DEFINE mark / GROUP;
DEFINE gender / ACROSS;
DEFINE overall / COMPUTED;
COMPUTE overall;
overall = SUM(_c5_, _c6_);
ENDCOMP;
BREAK BEFORE class / SUMMARIZE;
RBREAK BEFORE / SUMMARIZE;
RUN;

...............Phil
deleted_user
Not applicable
Thank you very much, Phil.

Your example seems useful. I am working on it.

Anne

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1315 views
  • 0 likes
  • 3 in conversation