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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.