DATA Step, Macro, Functions and more

how to get the consecutive elevations flagged

Reply
New Contributor
Posts: 3

how to get the consecutive elevations flagged

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.

Trusted Advisor
Posts: 1,128

Re: how to get the consecutive elevations flagged

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
Ask a Question
Discussion stats
  • 1 reply
  • 152 views
  • 0 likes
  • 2 in conversation