data want1;
set have;
where cPOSMode in ('07','90');
run;
data want2;
set have;
where cPOSMode in ('02')
and cToken is not null
and cPvder is not null
and idTReq is not null;
run;
data want1; set want1 want2;run;How do I simplify above 3 data steps into 1?
Combine WHERE clauses into 1 step using an OR
@afiqcjohari wrote:
data want;
set have;
where cPOSMode in ('07','90') or (cPOSMode in ('02') and cToken is not null and cPvder is not null and idTReq is not null);
;run;
?
data want;
set have;
if cposmode in ('07','90') or
cposmode='02 and (ctoken ne "" and cpvder ne "" and idtreq ne "") then output;
run;
Note, I assume the three varaibles are character as you don't say. Also, use one casing for your code, mixing casing makes code harder to read.
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.