Hi, everyone
I would like to use proc report to create this output:
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.
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.
You don't have to include anything...
define name;
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.
I just want to show who is the oldest.
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.
Does this mean that proc report can not handle it?
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.