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 open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.