I am having trouble understanding why " OR " is used instead of " AND " for Step 3.
The Question Asked:
Step 1:
create a temporary data set,cleandata36.
In this data set, convert allgroupvalues to upper case.
Then keep only observations withgroupequal to 'A' or 'B'.
Step 2:
Determine the MEDIAN value for theKilogramsvariable for eachgroup (A,B) in thecleandata36data set. Round MEDIAN to the nearest whole number.
Step 3:
createresults.output36fromcleandata36
Ensure that all values for variable Kilogramsare between 40 and 200, inclusively.
If the value is missing or out of range, replace the value with the MEDIANKilogramsvalue for the respectivegroup(A,B) calculated in step 2.
Step 1: data work.cleandata36;
set cert.input36;
group=upcase(group);
if upcase(group) in ('A','B');
run;
Step 2: proc means data=work.cleandata36 median;
class group;
var kilograms;
run;
Step 3: data results.output36;
set cleandata36;
if Kilograms < 40 OR Kilograms > 200 then do;
if group='A' then kilograms=79;
else kilograms=89;
end;
run;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.