BookmarkSubscribeRSS Feed
Ivy
Quartz | Level 8 Ivy
Quartz | Level 8

Dear all,

 

Anybody can tell me how the "hasc = 1  or hasf = 1 "  generated during the following programming ?  Thank you.  Ivy

 

data  test_1 ;
set test;
by ID lot admin_date drug;
retain hasc hasf;
if first.lot then do;
hasc=0;
hasf=0;
end;
if drug = "CAPECITABINE" then do;
if hasf = 1 then drug = "FLUOROURACIL";
else hasc = 1;
end;
if drug = "FLUOROURACIL" then do;
if hasc = 1 then new_drug = "CAPECITABINE";
else hasf = 1;
end;
run;

 

 

1 REPLY 1
Reeza
Super User

It's a bit circular, To confuse it all, there's a retain statement that keeps the values across the rows, so it looks like it's alternating drugs?

If you post some sample data tracing the program out may help. 

 

HASC=1 if

DRUG=CAPECITABINE and HASF=0

 

HASF=1 if

DRUG=FLUOROURACIL and HASC=1

 

 

 

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