Maybe add a WHERE statement to Tom's code, e.g.
proc summary data=have;
by date location;
var ph_level;
output out=want mean=mean_ph_level;
where ph_level ne 0;
run;
or
proc summary data=have;
by date location;
var ph_level;
output out=want mean=mean_ph_level;
where NOT (location='Dup' and ph_level=0) ;
run;
Should be simple.
proc summary data=have;
by date location;
var ph_level;
output out=want mean=mean_ph_level;
run;
I don't understand this part "the non-zero duplicate samples with the main samples". 0 should be a perfectly valid value of pH. Why would you want to exclude them?
Maybe add a WHERE statement to Tom's code, e.g.
proc summary data=have;
by date location;
var ph_level;
output out=want mean=mean_ph_level;
where ph_level ne 0;
run;
or
proc summary data=have;
by date location;
var ph_level;
output out=want mean=mean_ph_level;
where NOT (location='Dup' and ph_level=0) ;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.