Hello I am not sure if someone could help me with the following:
I have a longitudinal dataset of a binary variable that is equal to 1 when there is an infection in a patient, otherwise it is 0. Sometimes infections persist for seveal visits, sometimes they only remain for one visit and the patient is cured.I want to create 3 variables (X!, X2, X3) that would indicate a 1 or a 0 according to the following criteria:
In other words, this is how is might look and what I which to have my program do:
ID visit1 visit2 visit3 visit4 VARIABLE X1 VARIABLE X2 VARIABLE X3
1 0 0 0 0 0 0 0
2 0 1 0 0 0 1 0
3 1 1 0 0 1 1 0
4 0 1 1 1 1 1 1
5 0 1 0 1 0 1 0
X1) Variable is = 1 when there is an infection for At least two or more consecutive visits per patient.
X2) Variable is = 1 when there is an infection for At least one visits per patient (Any infection).
X3) Variable is = 1 when there is an infection for At least three or more consecutive visits per patient.
Anyone can help me? I do not know how to solve this.
Thank youse
Something like this perhaps.
How does 'not not find' works here? Is it a function by any chance?
NOT is a Boolean operator, in this case NOT NOT turns the position returned by FIND into 1 or ZERO making a Boolean of it.
Or to use parenthesis to get the Boolean: x1=(find(r,'11')>0);
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.