If you want this bit of code to make sure that two variables are not used for analysis conditionally
data thesis1.geitcompleet_totaal1;
set thesis1.geitcompleet_totaal1;
if tlt ne . then delete sterftereden sterftedatum;
run;
then the proper code is likely
data thesis1.geitcompleet_totaal1;
set thesis1.geitcompleet_totaal1;
if tlt ne . then call missing (sterftereden, sterftedatum);
run;
Call Missing will set the values of the variables to missing and will by default be excluded from analysis. SAS will not allow you to remove Variables conditionally. The variable is either in the data set or not. If you want the variable values to be available for TLT when missing this is the approach:
Warning: Use of the same data set on the Set and Data statements such as
data somename;
set somename;
<any other code>
run;
completely rewrites the data set which means that a logic error could remove/replace values you don't want to change. At this point in your experience I strongly recommend that your data step always creates a new data set.
data new;
set somename;
<other code>
run;
That way when you make a minor coding mistake you do not have to go back to step one. This does not mean that you need to make a new set for each change. You could change the dummy code above to:
data new;
set somename;
<other code>
<added code>
run;
which preserves the original Somename data set and generates different versions of New.
... View more