BookmarkSubscribeRSS Feed
asp778ACU
Calcite | Level 5

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.

2 REPLIES 2
KachiM
Rhodochrosite | Level 12

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;

 

Ksharp
Super User

QRANGE option is for that.

 

proc means data = sashelp.class(keep=age) Q1 Q3 qrange ;
   var Age;
    run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1117 views
  • 4 likes
  • 3 in conversation