Unfinished Code
*HW 3 - Problem 2;
proc ;
run;
finished code
data lab.oldest_ages;
set lab.main;
OldestMother = .;
OldestFather = .;
if dmage > OldestMother then
OldestMother = dmage;
if dfage < 99 ;
if OldestFather = . or dfage > OldestFather then
OldestFather = dfage;
where dmage ^= . and dfage ^= .;
run;
proc print data= lab.oldest_ages (firstobs = 1 obs=10);
var dmage dfage;
run;
Since the "unfinished code" begins with the word PROC, it looks like you should use a SAS procedure, and not a DATA step.
Take a look at PROC MEANS.
You will need to run it twice (once for the fathers and once for the mothers), because excluding fathers age 99 might exclude an observation needed for processing the mothers.
As @Astounding pointed correctly, you'd have to use procedure (as in the description of you homework 😉).
Although, the data step is incorrect anyway:
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.