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';

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
  • 1 reply
  • 705 views
  • 0 likes
  • 2 in conversation