BookmarkSubscribeRSS Feed
Rixile106
Fluorite | Level 6

Good day expects.

 

i nedd to replicate values from column A_EXP_DT to new_dt.

 

 

data VIEW;

set TEST;

if A_EXP_DT = '99999999' then new_dt = '99991231';


RUN;
Spoiler
Rixile106_0-1637062473789.png
Spoiler
Expected outcome:

Rixile106_1-1637062572540.png

 

 

 

 

 

5 REPLIES 5
EyalGonen
Lapis Lazuli | Level 10

I think this is what you want:

 

data VIEW;
set TEST;
new_dt = A_EXP_DT;
if A_EXP_DT = '99999999' then new_dt = '99991231';
RUN;
PeterClemmensen
Tourmaline | Level 20

How about

 

data VIEW;

   set TEST;

   new_dt = A_EXP_DT;
   if A_EXP_DT = '99999999' then new_dt = '99991231';

RUN;
Rixile106
Fluorite | Level 6

exactly what i want .thank you  a lot

Venky3110
Fluorite | Level 6
This may help
data VIEW; set TEST; A_EXP_DT =new_dt ; if A_EXP_DT = '99999999' then new_dt = '99991231'; RUN;

 

Peter_C
Rhodochrosite | Level 12
It is what COALESCE functions do.
As this column seems to hold what looks like a date but as a character string, the particular function might be
COALESCEC()

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 398 views
  • 0 likes
  • 5 in conversation