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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
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.