BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dyrma
Fluorite | Level 6

Hi, everyone

I would like to use proc report to create this output:

 

class.png

 

I'm trying this way:

 

proc report data=sashelp.class;
    column sex name age;
    define sex / group;
    define age / max  'Max. Age';
    define name / ????????;
run;

 

How to define 'name' to receive the output above?

 

Thanks very much for your suggestions.

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

It may be possible, with some coding effort, however data processing really isn't the purpose of proc report. Use one of the data summarisation procedures (summary for instance) or you could simply sort the data and take first by group observation.   

View solution in original post

7 REPLIES 7
Reeza
Super User

You don't have to include anything...

 

define name;
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Thats not going to work.  You are summarising data by sex - name has no relevance in this summarisation.  Why should it show Jane and not some other value?  Makes no sense to have name as a column there.

dyrma
Fluorite | Level 6

I just want to show who is the oldest.

Reeza
Super User

Use PROC SUMMARY with the ID to associate the name with the highest value. You can use PROC REPORT to display the output. 

 

PROC REPORT can summarize data but it's easier outside IMO. 

dyrma
Fluorite | Level 6

Does this mean that proc report can not handle it?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

It may be possible, with some coding effort, however data processing really isn't the purpose of proc report. Use one of the data summarisation procedures (summary for instance) or you could simply sort the data and take first by group observation.   

dyrma
Fluorite | Level 6
thanks a lot Reeza and RW9

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
  • 7 replies
  • 1219 views
  • 1 like
  • 3 in conversation