Hi,
I'm trying to check the consistency of values of a variable across different timepoints.
"Regular" records will have consistency checked for across all 5 timepoints. However, there are some special cases (based on the variable called timepoint) that should only look at CERTAIN timepoints rather than looping through all of them.
Timepoint can represent a single timepoint or up to 2:
Timepoint
1
2
3
4
5
1, 2
2, 3
3, 4
4, 5
1, 3
etc.
Essentially what I'd like to do is set up the do-loop so that the iteration is conditional and based on the value of timepoint, ie:
1. If timepoint is missing (regular record) do i = 1 to 5
2. If timepoint = 1, cycle through every timepoint EXCEPT timepoint 1 (so do i = 2 to 5).
Any help is much appreciated.
Hi @Walternate,
You can use the CONTINUE statement to "skip" the values in TIMEPOINT:
data have;
input timepoint $4.;
cards;
.
1
2
3
4
5
1, 2
2, 3
3, 4
4, 5
1, 3
;
data want;
set have;
do i=1 to 5;
if findw(timepoint,put(i,1.)) then continue;
/* more code to "check the consistency of values" */
output; /* <-- just as an example */
end;
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.