BookmarkSubscribeRSS Feed
rams
Calcite | Level 5

hiii

i have a querry like this

subjecttestvisithigh_rangeactual_value
101A130100
101A23090
101A33080
101A43060
101A53055
101A63065
101A730102
101A83095
101B140130
101B240150
101B34065
101B44085
101B540120
101B640135

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.

1 REPLY 1
Jagadishkatam
Amethyst | Level 16

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

Thanks,
Jag

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
  • 1 reply
  • 821 views
  • 0 likes
  • 2 in conversation