Hi Team,
I have the data like below:
Subject | FolderName | FolderSeq | VSTEMP | VSTPT | count |
101 | Screening | 1.0 | 37.1 | Supine | 1 |
101 | Day 1 | 2.0 | 36.9 | Supine | 1 |
101 | Day 8 | 5.0 | 36.8 | Supine | 1 |
101 | Day 15 | 6.0 | 37.1 | Supine | 1 |
101 | Day 22 | 7.0 | 36.7 | Supine | 1 |
101 | Day 29 | 8.0 | 36.9 | Supine | 1 |
101 | Day 36 | 9.0 | 36.9 | Supine | 2 |
101 | Day 43 / ET | 10.0 | 36.8 | Supine | 1 |
101 | Safety Follow-Up | 12.0 | 36.6 | Supine | 1 |
102 | Screening | 1.0 | 36.8 | Supine | 1 |
102 | Day 1 | 2.0 | 36.8 | Supine | 2 |
102 | Day 8 | 5.0 | 36.8 | Supine | 3 |
102 | Day 15 | 6.0 | 37.0 | Supine | 1 |
102 | Day 22 | 7.0 | 37.1 | Supine | 1 |
102 | Day 29 | 8.0 | 36.9 | Supine | 1 |
102 | Day 36 | 9.0 | 37.0 | Supine | 1 |
102 | Day 43 / ET | 10.0 | 37.0 | Supine | 2 |
102 | Safety Follow-Up | 12.0 | 36.9 | Supine | 1 |
I am want like below, i tried m in data step but its not working.
Subject | FolderName | FolderSeq | VSTEMP | VSTPT | count | Sub_cnt |
101 | Screening | 1.0 | 37.1 | Supine | 1 | 1 |
101 | Day 1 | 2.0 | 36.9 | Supine | 1 | 1 |
101 | Day 8 | 5.0 | 36.8 | Supine | 1 | 1 |
101 | Day 15 | 6.0 | 37.1 | Supine | 1 | 1 |
101 | Day 22 | 7.0 | 36.7 | Supine | 1 | 1 |
101 | Day 29 | 8.0 | 36.9 | Supine | 1 | 2 |
101 | Day 36 | 9.0 | 36.9 | Supine | 2 | 2 |
101 | Day 43 / ET | 10.0 | 36.8 | Supine | 1 | 1 |
101 | Safety Follow-Up | 12.0 | 36.6 | Supine | 1 | 1 |
102 | Screening | 1.0 | 36.8 | Supine | 1 | 3 |
102 | Day 1 | 2.0 | 36.8 | Supine | 2 | 3 |
102 | Day 8 | 5.0 | 36.8 | Supine | 3 | 3 |
102 | Day 15 | 6.0 | 37.0 | Supine | 1 | 1 |
102 | Day 22 | 7.0 | 37.1 | Supine | 1 | 1 |
102 | Day 29 | 8.0 | 36.9 | Supine | 1 | 1 |
102 | Day 36 | 9.0 | 37.0 | Supine | 1 | 2 |
102 | Day 43 / ET | 10.0 | 37.0 | Supine | 2 | 2 |
102 | Safety Follow-Up | 12.0 | 36.9 | Supine | 1 | 1 |
Please post the data as data steps using datalines and describe the rules that want applied. If you have tried something, post the code you have, so that we can suggest corrections.
Subject | FolderName | FolderSeq | VSTEMP | VSTPT | count |
101 | Screening | 1.0 | 37.1 | Supine | 1 |
101 | Day 1 | 2.0 | 36.9 | Supine | 1 |
101 | Day 8 | 5.0 | 36.8 | Supine | 1 |
101 | Day 15 | 6.0 | 37.1 | Supine | 1 |
101 | Day 22 | 7.0 | 36.7 | Supine | 1 |
101 | Day 29 | 8.0 | 36.9 | Supine | 1 |
101 | Day 36 | 9.0 | 36.9 | Supine | 2 |
101 | Day 43 / ET | 10.0 | 36.8 | Supine | 1 |
101 | Safety Follow-Up | 12.0 | 36.6 | Supine | 1 |
102 | Screening | 1.0 | 36.8 | Supine | 1 |
102 | Day 1 | 2.0 | 36.8 | Supine | 2 |
102 | Day 8 | 5.0 | 36.8 | Supine | 3 |
102 | Day 15 | 6.0 | 37.0 | Supine | 1 |
102 | Day 22 | 7.0 | 37.1 | Supine | 1 |
102 | Day 29 | 8.0 | 36.9 | Supine | 1 |
102 | Day 36 | 9.0 | 37.0 | Supine | 1 |
102 | Day 43 / ET | 10.0 | 37.0 | Supine | 2 |
102 | Safety Follow-Up | 12.0 | 36.9 | Supine | 1 |
Subject | FolderName | FolderSeq | VSTEMP | VSTPT | count | Sub_cnt |
101 | Screening | 1.0 | 37.1 | Supine | 1 | 1 |
101 | Day 1 | 2.0 | 36.9 | Supine | 1 | 1 |
101 | Day 8 | 5.0 | 36.8 | Supine | 1 | 1 |
101 | Day 15 | 6.0 | 37.1 | Supine | 1 | 1 |
101 | Day 22 | 7.0 | 36.7 | Supine | 1 | 1 |
101 | Day 29 | 8.0 | 36.9 | Supine | 1 | 2 |
101 | Day 36 | 9.0 | 36.9 | Supine | 2 | 2 |
101 | Day 43 / ET | 10.0 | 36.8 | Supine | 1 | 1 |
101 | Safety Follow-Up | 12.0 | 36.6 | Supine | 1 | 1 |
102 | Screening | 1.0 | 36.8 | Supine | 1 | 3 |
102 | Day 1 | 2.0 | 36.8 | Supine | 2 | 3 |
102 | Day 8 | 5.0 | 36.8 | Supine | 3 | 3 |
102 | Day 15 | 6.0 | 37.0 | Supine | 1 | 1 |
102 | Day 22 | 7.0 | 37.1 | Supine | 1 | 1 |
102 | Day 29 | 8.0 | 36.9 | Supine | 1 | 1 |
102 | Day 36 | 9.0 | 37.0 | Supine | 1 | 2 |
102 | Day 43 / ET | 10.0 | 37.0 | Supine | 2 | 2 |
102 | Safety Follow-Up | 12.0 | 36.9 | Supine | 1 | 1 |
What is the logic here? Why is the value of sub_cnt equal to 2 for Day 29 subject 101?
we need to flag as yes for 3 or more consecutive values. but in my logic if i have 2 consecutive values also it is flagging yes but i do not want flag as yes if i have only 2 consecutives.
@Mastanvali wrote:
we need to flag as yes for 3 or more consecutive values. but in my logic if i have 2 consecutive values also it is flagging yes but i do not want flag as yes if i have only 2 consecutives.
I don't know what this means. 3 or more consecutive values of what? Flag for what reason? No flag is mentioned or shown in your original post.
How does the value of sub_cnt equal to 2 for Day 29 subject 101? Please walk me through this step-by-step.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.