@LinusH Is all about patients who received certain treatments on each visit (let's say visits 1 to 10), But there a certain patients who took part in a clinical trial who should be excluded from this project. Now for each visit there is a variable which indicate if they took part in a clinical trial at that specific visit (if yes then the variable= Y and if no then it's =N)
That was what I tried to depict above with var1 to var4 . Now I need to select all patients who did not take take in a clinical trial for all visits 1 to 10 (that means var1 to var10 has to be N, there shouldn't be any Y's in the dataset)
All this selection should include all data of the patients like the id, age, sex, diagnosis date, deathdate, type of treatment etc.....
I did this with sas macro that looks like this and later merged them:
%macro test (num);
proc sql,
create table want&num as select id, therapy&num, visit&num, clintrial&num where clintrial&num="N";
quit;
%mend;
%test(1); %test(2); %test(3); %test(4); %test(5);%test(6); %test(7); %test(8); %test(9); %test(10); *merge all 10 datasets; data want, merge want:; by id; run;
My problem here is I can't select all variables, since if I do that for test1 for example then I will have test2 to test10 with undesired values in there. So I was thinking there is a better way doing that. But it seems to be complicated
... View more