Hello Thank you very much for your suggestion. I would like to kindly ask another related question. The dataset I sent above was simply a "training" dataset, just to make sure that I was doing all the necessary and correct exclusions. So, when i wrote that it worked in my comment, I meant that it worked perfectly well in the "training" dataset. The "training" dataset mimics the real dataset, in which each participant (determined by "newid") can have different lines for each cancer that they have (differerent observations; if they have more than one cancer). However, when I tried to apply the code to the real dataset, SAS gets "blocked" (every time it goes in the state of "SAS non responding") Let me explain: The real dataset contains about 5000 observations. I do a first code of exclusion to eliminate all non-melanoma prevalent cancers, with the following code: proc sql; create table all4 as select * from all3 where newid not in (select distinct newid from all3 where incidence eq 0 and nomel eq 0) ; quit; This code runs perfectly well in less than one minute. If there is an individual (defined by "newid") that has a prevalent cancer, then this codes eliminates all lines that are associated with that "newid" (it eliminates all the observations from that person). In this case "nomel" is non-melanoma skin cancer. Now I try to apply the code that was suggested here to the new dataset created in this case, namely "all4". I try to eliminate here all the "nomel" only in those that have multiple observations, but keep it in those that do not have multiple observations. I run the following: proc sql; create table all5 as select newid from all4 group by newid having count(*) > 1; delete from all4 where newid in (select newid from all5) and NOMEL=1; select * from all4; quit; however, when I run this, SAS gets "blocked". It just does not run ("SAS non responding"). I tried this different times in many different days, but the same problem persists. At first I assumed that it was a complex operation that just needed time, but I left it running for an hour, and nothing changed. In the "training" dataset that I brought it, it worked perfectly fine and quickly. I do not know why when i try to run it in the real dataset, it creates this problem, since it is not very different from the other "proc sql" code above. Can you please help me? Thank you very much
... View more