05-02-2024
gabagotati
Calcite | Level 5
Member since
08-24-2022
- 10 Posts
- 0 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by gabagotati
Subject Views Posted 836 03-28-2024 04:16 PM 715 01-06-2023 05:13 PM 744 01-06-2023 04:53 PM 1079 09-19-2022 01:36 PM 1112 09-19-2022 12:13 PM 1306 08-24-2022 02:43 PM 1328 08-24-2022 02:06 PM 1387 08-24-2022 12:03 PM -
Activity Feed for gabagotati
- Posted Count number of days within a span in a given year on SAS Programming. 03-28-2024 04:16 PM
- Posted Re: Appending specific year to an extracted month and day on SAS Programming. 01-06-2023 05:13 PM
- Posted Appending specific year to an extracted month and day on SAS Programming. 01-06-2023 04:53 PM
- Posted Re: Search columns for match in string from other table on SAS Programming. 09-19-2022 01:36 PM
- Posted Search columns for match in string from other table on SAS Programming. 09-19-2022 12:13 PM
- Posted Re: Retaining max values over multiple columns on SAS Programming. 08-24-2022 02:43 PM
- Posted Re: Retaining max values over multiple columns on SAS Programming. 08-24-2022 02:06 PM
- Posted Retaining max values over multiple columns on SAS Programming. 08-24-2022 12:03 PM
03-28-2024
04:16 PM
I have a dataset with a list of members and spans they were enrolled in a certain program. Start2 and End2 are populated if this member was enrolled in another span in addition to the first span, and if it does not overlap. member start1 end1 start2 end2 123 01MAR2020 01APR2020 01FEB2022 30JUN2023 456 01JAN2019 01JAN2020 789 13APR2023 15APR2023 I want to count the number of days that the member was enrolled for a given year, like below: member start1 end1 start2 end2 days2019 days2020 days2021 days2022 days2023 123 01MAR2020 01APR2020 01FEB2022 30JUN2023 0 31 0 333 180 456 01JAN2019 01JAN2020 365 1 0 0 0 789 13APR2023 15APR2023 0 0 0 0 3 I've tried creating an array with the full list of days that the member was enrolled and matching to the days of a given year, but that seems inefficient. Would appreciate any help!
... View more
01-06-2023
05:13 PM
Thanks for you response. The reason I am interested in extracting the specific month and day is that is I have another variable (date of enrollment), and I'd like to find their age at this date. For A2543 in my example, they are 18 after their birthday of 08OCT2018 and before their next birthday 08OCT2019. If their enrollment date was on 01JUN2019, they would be 18 on this day. Your solution would yield age_2019 of 19, which would not be what I want. Apologies for not including this piece in my original post.
... View more
01-06-2023
04:53 PM
I have a dataset with unique IDs and date of births, and I would like to calculate their age from future birthdays in specific years (for example, 2018 and 2019). I understand how to calculate age between two dates, but am having trouble with creating the dates of the future birthdays in the first place. In other words, I'd like to take the month and day of their birthday, and append to a specified year. Have: ID_1 DOB A2543 08OCT1993 A3667 12JUL2003 A3624 30MAR2000 Want: ID_1 DOB bday_2018 bday_2019 age_2018 age_2019 A2543 08OCT1993 08OCT2018 08OCT2019 26 27 A3667 12JUL2003 12JUL2018 12JUL2019 15 16 A3624 30MAR2000 30MAR2018 30MAR2019 18 19
... View more
09-19-2022
01:36 PM
Yes - the string in relevant_id is always a length of 3.
... View more
09-19-2022
12:13 PM
I have two tables- one table has 10 character variables, ID1 up to ID4. The other table is a lookup table; that one has just one variable of sales ID strings I am interested in. What I have: ID_1 ID_2 ID_3 ID_4 A2543 A3700 C3404 A4314 A3667 C1000 F3123 A3414 A3624 D1434 F1334 A0394 A6000 A4303 A3802 A4137 B7000 B6205 B5310 B1394 data relevant_ID;
length salesID $3;
input salesID;
datalines; A36
A37
A38
A39
A40
A41
A42
A43
A44
A45
A46
A47
A48
A49
A50
;
run; I would like to search the table ID_1 to ID_4 to see if any of those columns include one of the values from relevant_ID. If so, I am trying to create a variable that flags whether any of those columns includes a relevant ID. Desired output: ID_1 ID_2 ID_3 ID_4 relevant_match A2543 A3700 C3404 A4314 1 A3667 C1000 F3123 A3414 1 A3624 D1434 F1334 A0394 1 A6000 A4303 A3802 A4137 1 B7000 B6205 B5310 B1394 0
... View more
08-24-2022
02:43 PM
Thank you, this works great as well! Do you have any guidance as to how to solve my follow-up question posted above?
... View more
08-24-2022
02:06 PM
Thank you, this makes a lot of sense! I have another follow-up question - what if we were to have 4 years of data per individual, but we only wanted to see if they had that disease within the last 2 years? My original dataset subject year disease1 disease2 disease 3 a 2019 1 1 1 a 2020 0 0 0 a 2021 0 0 0 a 2022 0 0 0 b 2019 0 1 1 b 2020 1 0 0 b 2021 1 0 0 b 2022 0 0 1 My desired output is below. For example - for subject a in 2021, since they had all 3 diseases in the prior year of 2019, they should also have flags for all those diseases in 2020 and 2021. But since 2022 is after the 2 year mark, and they did not have the disease in 2020 and 2021, they will not have flags for the year 2022. My desired output subject year disease1 disease2 disease 3 a 2019 1 1 1 a 2020 1 1 1 a 2021 1 1 1 a 2022 0 0 0 b 2019 0 1 1 b 2020 1 1 1 b 2021 1 1 1 b 2022 1 0 1
... View more
08-24-2022
12:03 PM
I have a dataset like below, and want to collapse a subject so that I can see if they were diagnosed with an of the 3 diseases at all within the past 3 years using Disease1-3 are binary yes/no flags. My original dataset subject year disease1 disease2 disease 3 a 2020 1 1 1 a 2021 0 0 0 a 2022 0 0 0 b 2020 0 1 0 b 2021 1 0 0 b 2022 0 0 1 My desired output is below. For example - for subject a in 2021, since they had all 3 diseases in the prior year of 2020, they should also have flags for all those diseases in 2021 and 2022. My desired output subject year disease1 disease2 disease 3 a 2020 1 1 1 a 2021 1 1 1 a 2022 1 1 1 b 2020 0 1 0 b 2021 1 1 0 b 2022 1 1 1 What would be the best way about going to do this? I've tried using a do loop and the retain statement, but get stuck due to the fact that there are multiple columns to consider (disease1-disease3).
... View more