06-09-2022
JFerron
Fluorite | Level 6
Member since
09-10-2020
- 3 Posts
- 4 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by JFerron
Subject Views Posted 618 06-09-2022 03:08 PM 623 06-09-2022 02:48 PM 711 06-07-2022 04:09 PM -
Activity Feed for JFerron
- Posted Re: Transforming Long Data with Nested Counts - Help! on SAS Programming. 06-09-2022 03:08 PM
- Liked Re: Transforming Long Data with Nested Counts - Help! for mkeintz. 06-09-2022 03:01 PM
- Liked Re: Transforming Long Data with Nested Counts - Help! for ballardw. 06-09-2022 02:49 PM
- Posted Re: Transforming Long Data with Nested Counts - Help! on SAS Programming. 06-09-2022 02:48 PM
- Posted Transforming Long Data with Nested Counts - Help! on SAS Programming. 06-07-2022 04:09 PM
- Liked Re: ERROR: Procedure CAUSALMED not found. for ballardw. 05-26-2022 09:21 AM
- Liked Re: Changing variable Format with proc import for ballardw. 09-10-2020 01:11 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 2
06-09-2022
03:08 PM
I could not get this code to count abstinence intervals. It just counts weekly or daily intervals (whichever I denote as my day variable). Here is my code: I have renamed (weekstartdate to date and created a daily variable). data want2 (drop=date day); do until (last.abs_yes); set counting_dates; retain day 1; by id date abs_yes notsorted; if first.abs_yes then do; beg_date= date + day-1; end; end; end_date=date+day-1; format beg_date end_date mmddyy10.; run; proc print data=want2 (obs =100); RUN; Can you help? I'm just not sure what I'm doing wrong. It runs, I'm just not getting the same output.
... View more
06-09-2022
02:48 PM
First, I would like to say thank you for your response. I probably mis-communicated the problem so, the output that I am getting is not quite right. It was giving me weekly output with abstinence marked. What I would like to do is to add the counter (labelled abs_yes) by whether it's on or off (1 vs 0) but sequentially. So for example, if the person has 2 days of off (abs_yes = 0), it would look like this: Obs id Abs start ends eventstart123 700 0 0 2 01/21/2013 700 1 2 15 01/23/2013 700 0 15 17 01/25/2013 In this example, I have recoded abs_yes to abs (in order to not change any variable names, per your suggestion). I'm assuming this requires some sort of lag function where I would track how many sequential days are on or off on the original (abs_yes)? If it helps, the eventstart variable is less important than the start and ends variable, which count the number of sequential days abstinence or smoking within an individual.
... View more
06-07-2022
04:09 PM
Hello! I'm struggling with a data transformation where I have about a years worth of days, 600 or so participants, and dates at the beginning of each week (always starting on Monday). It looks like this: id weekstartdate day Abs_yes 808 1/3/2022 1 0 808 1/3/2022 2 0 808 1/3/2022 3 0 808 1/3/2022 4 0 808 1/3/2022 5 1 808 1/3/2022 6 1 808 1/3/2022 7 1 808 1/10/2022 1 0 808 1/10/2022 2 0 808 1/10/2022 3 0 808 1/10/2022 4 1 I am trying to get my output dataset so it can be used for a recurrent event survival analysis and it would count each event (abs_yes = 1) and non (event (abs_yes = 1) within the individual where there are events (even as few as 1 in a row). I currently only have the start date of each week (which are consecutive and would also like to output the beginning date (weekstartdate) of each event. In the example below, the abs_yes variable serves as an indicator for the length of the episode. id weekstartdate Abs_yes start ends 808 1/3/2022 0 0 4 808 1/7/2022 1 4 7 808 1/10/2022 0 7 10 808 1/13/2022 0 10 11 I have had many false starts using nested do-loops. This data had been a wide file with days of abstinence by week across the row. So, I have gotten the data closer to the objective but am not sure how to get the program to repeat a count within an id (I can get it to count how many abs_yes within each id but not length in days of episode). I would really appreciate any help/tips that I can get! Thanks, Joelle
... View more