Hi, I have searched the forum for help for my problem, and I think i have an idea how to solve it, but I need some more help. I would really appreciate if someone out there could help me. I am new to SAS EG and have limited SAS programming skills. I do however have a good understanding of general code.
My data set is structured as follows:
Occurrence ID (unique) Person ID Date Calculated column 1
x1 y1 n1
x2 y2 n2
x3 y1 n3
x4 y1 n4
I want to populate the calculated column according to how many days there are between two occurrences for a unique person.
For example:
For person ID = y1. Days between occurrence x3 and x1 = n3 - n1. The value will thereafter either set a 1, 2, 3 or 4 in the calculated column according to how many days there are.
My idea is to transpose the data set as follows:
Person ID (unique) x1 x2 x3 x4 Calculated column x1 Calculated column x2 ...
y1 n1 n2 n4
y2 n3
I can thereafter calculate by comparing columns x1,...xn for each person ID.
After this step, I need to transpose the data set back in order to have a unique calculated column values for each Occurrence ID.
Is this a good approach or do any of you have a better idea how I might attack this problem?
Thank you!
I don't know that you need to transpose but you will need to sort.
I don't know that you need to transpose but you will need to sort.
Thank you!
Much easier and exactly what I want to achieve.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.