BookmarkSubscribeRSS Feed
Smitha9
Fluorite | Level 6

Hi,

I have dataset a

ID         Version        Session_A     SetA           SetB

1            2234            2234             1

1            2234            2236                                 1

2            3345            3345             1

2            3345            3367                                  1

3            4456            4456                                  1

4            5568            5568                                   1

5            5568            5523                                   1

I would like to delete all the setB which has SetA=1 with same Version

output dataset B:

ID         Version        Session_A     SetA           SetB

3            4456            4456                                  1

4            5568            5568                                   1

5            5568            5523                                   1

 

thanks in advance

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

Repeating a request that has already been made to you:

 

Please provide data as working SAS data step code from now on. You can follow these instructions or type the working SAS data step code yourself. Doing this avoids us having to make assumptions or guesses about your data (which might be incorrect), which makes it much more likely that people can provide correct answers; this helps you and helps us.

--
Paige Miller
ballardw
Super User

Does the ID variable have any role in selection? It is not described as such.

Why are you mentioning SetB? I don't see where SetB has any impact on the output.

 

Are there values for SetA other than 1 and Missing? Is SetA numeric or character? (Need to have the correct variable type to write a test for values that does not create errors or data conversion messages)

Smitha9
Fluorite | Level 6
All are the variables numeric,the setB is the variable.
Ksharp
Super User
data have;
input ID         Version        Session_A     SetA           SetB;
cards;
1            2234            2234             1 .
1            2234            2236              .                   1
2            3345            3345             1 .
2            3345            3367              .                    1
3            4456            4456              .                    1
4            5568            5568             .                      1
5            5568            5523              .                     1
;

proc sql;
create table want as
select * from have
 group by id ,version
  having not (max(seta)=1 and max(setb)=1);
quit;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1132 views
  • 1 like
  • 4 in conversation