Sex | Age |
F | 13 |
F | 13 |
F | 14 |
F | 12 |
F | 15 |
F | 11 |
F | 14 |
F | 12 |
F | 15 |
M | 14 |
M | 14 |
M | 12 |
M | 13 |
M | 12 |
M | 16 |
M | 12 |
M | 15 |
M | 11 |
M | 15 |
i have above dataset how derive extra record for maximum age like see below dataset
Sex | Age | status |
F | 11 |
|
F | 12 |
|
F | 12 |
|
F | 13 |
|
F | 13 |
|
F | 14 |
|
F | 14 |
|
F | 15 |
|
F | 15 |
|
F | 15 | maximum |
M | 11 |
|
M | 12 |
|
M | 12 |
|
M | 12 |
|
M | 13 |
|
M | 14 |
|
M | 14 |
|
M | 15 |
|
M | 15 |
|
M | 16 |
|
M | 16 | maximum |
Hello,
data have;
input Sex $ Age;
datalines;
F 13
F 13
F 14
F 12
F 15
F 11
F 14
F 12
F 15
M 14
M 14
M 12
M 13
M 12
M 16
M 12
M 15
M 11
M 15
;
run;
proc sort ; by sex age;
run;
data want;
set have;
by sex age;
if last.sex then status='maximum';
run;
Thanks,
Hello,
If a simple salutation is available ,Why you want to make it complex by using loops . if you use explicit loop , it'll take so more time then implicit loop.
Meanwhile you can use Array to fulfill yr request .
Thanks...
As soon as you mark one of my previous answers to your posts as a solution, I might be tempted to provide such code.
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 save with the early bird rate—just $795!
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.