Try this 🙂
/*Using for example instream dataset otherwise if you have SAS dataset, then SET statement*/ /* OPTION 1- Set outliers to missing in DATA step if you want the outliers to be replaced with missing values*/ /* OPTION 2- You need not set outliers to missing but subsetting WHERE statement in PROC MEANS works fine*/ DATA outliers; INFILE DATALINES; INPUT sleep age @@; IF (sleep LT 1 OR sleep GT 12) THEN sleep=.; DATALINES; 1 20 3 40 12 30 13 40 9 90 ; RUN;
/*Print data to see if outliers are replaced with missing values*/ PROC PRINT DATA=outliers NOOBS; RUN;
PROC MEANS DATA=outliers; VAR sleep age; WHERE sleep GE 1 AND sleep LE 12; RUN;
... View more