In the previous chapter, while introducing CALL SYMPUT, we looked at an example where the objective was to output records from 2019 and 2013 of the youngest people in each year with the maximum height. We had to store the ClassIDs of the people we were looking at and then pass this information on to a Proc Print statement to get the desired output. By using Call Execute, we can shorten the process to get the output in at least two steps:
Proc Sort Data = Class Out = Sorted;
By Descending Year Age Descending Height;
Run;
Data First;
Set Sorted;
By Descending Year Age Descending Height;
If First.Year and First.Height Then Output First;
Call Execute ('Proc Print Data = _LAST_; Where Year = 2019; Run;');
Call Execute ('Proc Print Data = _LAST_; Where Year = 2013; Run;');
Run;
The output will be the same as it was in previous chapter.
...