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
SAS Super FREQ
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

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