SAS Where statement in a data step requires reference to values in data sets on the SET statement. So "where z" is not valid. Also WHERE does not use "then" in any form. The purpose of where is selection of records so specifically a "then output" would be redundant.
You could use to select records such that x+y is > 30 if you really want to use where.
Data b;
set a;
where (x+y)>30;
run;
If you need the variable z you would have to create it.
Or use an IF. This is a "sub-setting if"
data b2;
set a;
z= x+y;
if z>30;
run;
The only observations processed after the IF will be those where the If is true. So the implied output at the end of the data step makes this equivalent to
data b2;
set a;
z= x+y;
if z>30 then output;
run;
Hint:
Provide your example data in the from of a working data step such as:
data a;
input x y;
datalines;
10 25
;
multiple lines of x y values in the datalines would allow testing more values.
@animesh123 wrote:
Table a
x=10
y=25
Data b;
set a;
z=x+y
wherez>30 then output;run;