How many observations did you lose when you ran this code?
Did you actually intend to remove observations just because some values of what I would suspect are responses to survey questions were something like "don't know" or "refused"? (a guess, there are a number of survey writers that us 7 for "don't know" and 9 for "refused").
It may make more sense unless you really have a good reason for deleting entire responses to use something like:
if dpq020=. then depression=.;
else if dpq020= 1 then depression=1;
else if dpq020=2 then depression=1;
else if dpq020=3 then depression=1;
else if dpq020=0 then depression=0;
else if dpq020=7 then depression=.;
else if dpq030=9 then depression=.;
and similar for those 7 and 9 values, set analysis variable to missing.
Setting values to missing will mean that those are not used for analysis. When you actually remove an observation, which is what the DELETE statement does, then the entire thing is not available at all.
If you want to restrict part of your analysis later to where there are "valid" responses use a WHERE statement such as
Proc freq data=some dataset;
where not missing(depression);
<other analysis code>
run;
In modeling procedures like regression missing values of the model variables by default will be ignored for the model, nothing extra needed unless you want to use "missing" as a valid level for variables which is often an option.
... View more