BookmarkSubscribeRSS Feed
nata1
Calcite | Level 5

data repeat;
input month irri $ rep response;
datalines;
1 irri60 1 13
1 irri60 2 14
1 irri60 3 15
1 irri80 1 16
1 irri80 2 16
1 irri80 3 16
2 irri60 1 15
2 irri60 2 14
2 irri60 3 15
2 irri80 1 24
2 irri80 2 27
2 irri80 3 25
3 irri60 1 17
3 irri60 2 16
3 irri60 3 17
3 irri80 1 32
3 irri80 2 27
3 irri80 3 30
4 irri60 1 19
4 irri60 2 17
4 irri60 3 23
4 irri80 1 32
4 irri80 2 38
4 irri80 3 34
5 irri60 1 20
5 irri60 2 19
5 irri60 3 26
5 irri80 1 35
5 irri80 2 40
5 irri80 3 37
;

3 REPLIES 3
nata1
Calcite | Level 5
Thank you, it worked!
this data was for repeated measures anaysis
Jagadishkatam
Amethyst | Level 16

we can achieve the same by arrays as below 

 

data want;
set repeat;
by month irri;
retain rep1-rep3;
array resp(*) rep1-rep3;
do i = 1 to dim(resp);
if first.irri then resp(i)=.;
end;
if response ne . then resp(rep)=response;
if last.irri;
drop rep response i;
run;
Thanks,
Jag

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 2102 views
  • 1 like
  • 3 in conversation