BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
AncaTilea
Pyrite | Level 9

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!

1 ACCEPTED SOLUTION

Accepted Solutions
DBailey
Lapis Lazuli | Level 10

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;

View solution in original post

4 REPLIES 4
AncaTilea
Pyrite | Level 9

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:

DBailey
Lapis Lazuli | Level 10

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;

AncaTilea
Pyrite | Level 9

Thank you.

Once I posted it, I figured it out myself.

Smiley Happy

AncaTilea
Pyrite | Level 9

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!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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
  • 4 replies
  • 515 views
  • 3 likes
  • 2 in conversation