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);
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.