BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NURAO
Obsidian | Level 7

PROC IML;
RESET NONAME;


START BP(A) GLOBAL (NY,NCOL,RMEAN,VARX,N);
RMEAN=J(NCOL(NY),1,0);
Q1=RMEAN;
Q3=RMEAN;
RMAD=RMEAN;
MADN=RMEAN;
LOWFEN=RMEAN;
UPPFEN=RMEAN;
LEFT=RMEAN;

F=1;
M=0;

DO J=1 TO NCOL(NY);

SAMP=NY[J];
L=M+SAMP;
TEMP=A[F:L];

Q=quartile (TEMP);
Q1[J]=Q[2,1];
Q3[J]=Q[4,1];
RMAD[J]=MAD(TEMP,"MAD");
MADN[J]=MAD(TEMP,"NMAD");
LOWFEN[J]=Q1[J]-(1.44*MADN[J]);
UPPFEN[J]=Q3[J]+(1.44*MADN[J]);
LEFT=TEMP[LOC(LOWFEN[J]<TEMP & TEMP<UPPFEN[J])];

M=L;
F=F+SAMP;

END;

PRINT LEFT;

 

FINISH;

********cubaan menggunakan data yg dijana*******;

NY = {11 11 11};
A = {5,8,7,3,9,4,3,29,5,6,7,
3,2,6,4,14,4,7,6,9,3,4,
9,9,8,7,10,11,27,12,15,17,16};

RUN BP(A);

QUIT;

 

Here, I wish to print matrix free from outliers for three group as the LOWFEN and UPPFEN are the fences to detect outliers and coding LEFT suppose the matrix that have been free from outliers.

1 ACCEPTED SOLUTION

Accepted Solutions
2 REPLIES 2
IanWakeling
Barite | Level 11

If you move PRINT LEFT inside the DO loop then it will execute 3 times, once for each group.

NURAO
Obsidian | Level 7

Thank you so much.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 2 replies
  • 604 views
  • 0 likes
  • 2 in conversation