hiii
i have a querry like this
| subject | test | visit | high_range | actual_value |
| 101 | A | 1 | 30 | 100 |
| 101 | A | 2 | 30 | 90 |
| 101 | A | 3 | 30 | 80 |
| 101 | A | 4 | 30 | 60 |
| 101 | A | 5 | 30 | 55 |
| 101 | A | 6 | 30 | 65 |
| 101 | A | 7 | 30 | 102 |
| 101 | A | 8 | 30 | 95 |
| 101 | B | 1 | 40 | 130 |
| 101 | B | 2 | 40 | 150 |
| 101 | B | 3 | 40 | 65 |
| 101 | B | 4 | 40 | 85 |
| 101 | B | 5 | 40 | 120 |
| 101 | B | 6 | 40 | 135 |
i want to flag the consecutive elevations of the actual_values that are >= 3 times the high_range
by each subject test.
i want those obervation for which the actual values are >= 3 times the high_range by subject test
ataset being sorted by subject test visit.
Thanks.
Hi Rams,
Hope this is what you wanted.
data have;
input subject test $ visit high_range actual_value;
cards;
101 A 1 30 100
101 A 2 30 90
101 A 3 30 80
101 A 4 30 60
101 A 5 30 55
101 A 6 30 65
101 A 7 30 102
101 A 8 30 95
101 B 1 40 130
101 B 2 40 150
101 B 3 40 65
101 B 4 40 85
101 B 5 40 120
101 B 6 40 135
;
data want;
set have;
if actual_value >= 3*high_range then flag=1;
else flag=0;
run;
Thanks,
Jag
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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 save with the early bird rate—just $795!
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.