Hi! I have a dataset where each row is a different person and each column is the date that they visited the study site. I have list of variables: Pdate1-Pdate1360 and Qdate1-Qdate705. I want to create a flag variable called Flagvar that indicates whether any of the Q dates fell within 30 days of any of the Pdates, but I’m new to arrays and not sure where I’m going wrong. Since I already have over 2000 columns I don't want to create a cartesian product. Here is my code: data want; set have; array Pdate{1360} Pdate1-Pdate1360; array Qdate{705} Qdate1-Qdate705; do k=1 to 1360; do j=1 to 705; if intck('day', Pdate{k}, Qdate{j}) le 30 then Flagvar=1; else Flagvar=0; end; end; run; Suggestions, please? Thanks in advance! I'm using SAS 9.4.
... View more