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;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.
Ready to level-up your skills? Choose your own adventure.