Hello @lawye010,
I agree with ballardw that 1/0 coded Yes/No variables are more convenient. Either way, coding IF-THEN/ELSE statements can be boring at times and also prone to typos (cf. 'yes' vs. 'Yes' and visit_Time0 vs. visit_type_Time0). You can avoid repetitions (and make your work more interesting 🙂 ) by using arrays and SAS functions.
Example (using character variables):
data have;
input (Time0person Most0person Time0tele Most0tele Time0phone Most0phone) (:$3.);
cards;
No Yes Yes Yes No No
No No Yes No Yes No
No No No No No Yes
No No No No No No
;
data want;
set have;
array vt[0:6] $10 _temporary_ (' ' 2*'in-person' 2*'telehealth' 2*'phone');
array tm[*] Time0person--Most0phone;
visit_type_time0=vt[whichc('Yes', of tm[*])];
run;
To make the comparison case-insensitive, you can use something like
visit_type_time0=vt[(find(cat(of tm[*]),'yes','i')-1)/3+1];
... View more