BookmarkSubscribeRSS Feed
ger15xxhcker
Quartz | Level 8

Hi!

 

 

data test;
input id date$ var1$ var2$;
datalines;
1 20900101 abc abc2
2 20070102 cdf cdf2
2 20900101 jdk lao2
1 20110101 cds sxa
1 20150202 jui wsa
3 20900101 wer wes2 
1 21000101 rte www
4 20190101 www rrr ; run;

This is my test data set. I'm looking for a solution for keeping the specified rows. If there is a 20900101  date from a particular id, then keep it. The other rows which have the same ID just drop it or delete .

 

so my final table I want it to look like that:

data test;
input id date$ var1$ var2$;
datalines;
1 20900101 abc abc2
2 20900101 jdk lao2
3 20900101 wer wes2
4 20190101 www rrr
;
run;

Thanks for your help!

 

1 REPLY 1
novinosrin
Tourmaline | Level 20

Are you asking for

data want;
set test;
if date='20900101';
run; 

or 

 

where date= '20900101';

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 387 views
  • 0 likes
  • 2 in conversation