Dataset
ssn Amt PLAN Mod
2345 233 9229 26
2345 244 9222 12
1234 222 9229 26
Expected result
ssn Amt PLAN Mod
2345 233 9229 26
1234 222 9229 26
I need to keep only one row for this ppt if it has row for both the plans (9229,9222) . I need to just poulate row for plan 9229. How can this be done with out dropping any variable.
Double DO loop
data want;
do until (last.ssn);
set have;
by ssn notsorted;
if plan = "9222" then has_9222 = 1;
end;
do until (last.ssn);
set have;
by ssn notsorted;
if plan = "9229" and has_9222 then output;
end;
drop has_9222;
run;
Untested, for lack of usable data.
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.