BookmarkSubscribeRSS Feed
adil256
Quartz | Level 8

Hi everyone,

 

I've the following dataset which i would like to subset. I want to only keep observations with Status 1 and Flag 0 & Status 2 and Flag 1.

The questions sounds quite easy but i'm quite new in sas programming. Any kind of help will be welcomed; 🙂

 

StatusflagCodeProg
10B1P1
10B2P2
10B2P2
10A1Q1
12A2Q2
12A3Q3
20D1P3
20D1P3
21C1Q4
21C1Q4
2 REPLIES 2
art297
Opal | Level 21
data want;
  set have;
  if (status eq 1 and flag eq 0) or (status eq 2 and flag eq 1);
run;

Art, CEO, AnalystFinder.com

 

adil256
Quartz | Level 8

Thank you very much. Have a good day.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1178 views
  • 1 like
  • 2 in conversation