Hi All,
I have below question
Data
test;
input
ID$ Month1 Month2 Month3 Month4;
cards
;
A1 29 60 91 119
A2 89 120 0 0
A3 1 30 61 89
A4 29 19 50 78
A5 6 37 68 96
;
run
;
I would like to count the months when month hit over 90
My desire output is as below
| Month1 | Month2 | Month3 | Month4 | Flag | |
| A1 | 29 | 60 | 91 | 119 | 3 |
| A2 | 89 | 120 | 0 | 0 | 2 |
| A3 | 1 | 30 | 61 | 89 | 0 |
| A4 | 29 | 19 | 50 | 78 | 0 |
| A5 | 6 | 37 | 68 | 96 | 4 |
Means in the first case A1 id is started from 29 at the month1 and continue until month3 where it reached 91 then flag is 3. On the other hand Case 3 in the month1 is 1 and month 2 is 30 which not added to 31 that time I want flag to be 0
Can someone help me, please
data want(drop=i);
set test;
flag=0;
array m(*) m:;
do i=1 to dim(m);
if m(i)>90 then do;
flag=i;
leave;
end;
end;
run;
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.