Greeting SAS Base Master Sifu,
I am trying to work Semi Interquartile Range (SIQR) for survey data report.
At present, we produce SIQR report in old Excel way (attached) which contains SIQR formula - but doing way will be labor intensive & prone to error due to size of the survey data set.
Due to limited SAS knowledge (i'm newbie), any insight or back-bone scripts will be appreciated.
Many thanks.
Semi Interquartile Range is (Q3 - Q1) * 0.5
Use Proc Means/Summary to get Q1 and Q3 for numeric variables and save the output to a Data set. Use this new data set to compute the required statistic.
ods output summary=work.q1q3;
proc means data = sashelp.class(keep=age) Q1 Q3 ;
var Age;
run;
ods output close;
data want;
set work.q1q3;
IQR = (Age_Q3 - Age_Q1) / 2;
run;
If you have an array of numeric values you can use IQR() function as:
data one;
iqr=iqr(2, 4, 1, 3, 999999);
put iqr=;
run;
QRANGE option is for that.
proc means data = sashelp.class(keep=age) Q1 Q3 qrange ;
var Age;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.