Hi.
How can I set to missing the dates that repeat?
data in;
informat ckd_dt date9.;
format ckd_dt date9.;
input c_id ckd_dt date9.;
cards;
3021 20SEP2001
3021 20NOV2001
3021 20FEB2002
3021 20FEB2002
3021 20FEB2002
;
data want;
3021 20SEP2001
3021 20NOV2001
3021 20FEB2002
3021 .
3021 .
;
Thank you!
proc sort in=in out=in;
by c_id ckd_dt;
run;
data want;
set in;
by c_id ckd_dt;
if not first.ckd_dt then ckd_dt=.;
run;
OK,
I got it.
Thank you.
proc sort data = in;by c_id ckd_dt;
data want;
set in;
by c_id ckd_dt;
if first.ckd_dt then new_dt = ckd_dt;
else new_dt= .;
run;
:smileyplain:
proc sort in=in out=in;
by c_id ckd_dt;
run;
data want;
set in;
by c_id ckd_dt;
if not first.ckd_dt then ckd_dt=.;
run;
Thank you.
Once I posted it, I figured it out myself.
![]()
ok,I got it.
Sorry for taking any of your time.
proc sort data = in;by c_id ckd_dt;
data want(drop = ckd_dt rename = (new_dt = ckd_dt))
set in;
by c_id ckd_dt;
if first.ckd_dt then new_dt = ckd_dt;
else new_dt= .;
run;
Thanks!
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.