02-14-2023
Ju_Fr
Calcite | Level 5
Member since
02-20-2022
- 3 Posts
- 1 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by Ju_Fr
Subject Views Posted 1881 10-26-2022 02:00 PM 458 04-27-2022 03:14 PM 516 04-27-2022 10:13 AM -
Activity Feed for Ju_Fr
- Liked Re: Turning sas date into character inside a macro for Tom. 10-27-2022 05:09 AM
- Posted Turning sas date into character inside a macro on SAS Programming. 10-26-2022 02:00 PM
- Posted Re: Identifying patients with gaps in medication longer than a set length of days on SAS Programming. 04-27-2022 03:14 PM
- Posted Identifying patients with gaps in medication longer than a set length of days on SAS Programming. 04-27-2022 10:13 AM
-
Posts I Liked
Subject Likes Author Latest Post 1
10-26-2022
02:00 PM
Hello everyone, I feel like my issue is a simple one yet I have been stuck on this for hours. I am trying to convert a SAS date variable (datetime20. format) into a string of characters YYYYMMDD inside a macro (code lines in bold). My macro calculates the number of months between my start and end date and then executes another macro (%request) at each incremented month. I need to transform my start date (a SAS date) to a string YYYYMMDD so that the second macro will run. When I run my programme I get stuck at the first loop and I come across this note : NOTE : Macro variable CHAR_DAY resolves to inputn('01JUL2014'd,yymmddn8.). It doesn't look like it's converting my date to a string. Could anyone help? Many thanks, Juliette %macro hormono(start_dt=,end_dt=); %let nbmonths=%eval(%sysfunc(intck(month,&start_dt.,&end_dt.))); %do i=0 %to &nbmonths; %if &i=0 %then %do; %let char_day=inputn(&start_dt.,yymmddn8.); %request(database, &char_day.); %end; %else %do; %let char_day2=inputn(%sysfunc(intnx(month,&start_dt,&i,s)),yymmddn8.); %request(temp, &char_day2.); proc sql; insert into database select * from temp; quit; %end; %end; %mend hormono;
... View more
04-27-2022
03:14 PM
Thank you @Reeza I did not know this function it works perfectly!
... View more
04-27-2022
10:13 AM
Hello all, I’m a new sas user and I’m stuck. I have a patient dataset with one line per patient and a dummy variable for each of 12 days. 1 is for when the patient has medication on hand and 0 when they do not. What I would like is to identify patients who have a medication gap of 4 days or more, along with the starting date of this gap. For example, patient A has such a gap that starts on day 4. Patient B has a gap of 2 days on days 2-3 but I’m only interested in their longer gap starting on day 8. The only code I managed to come up with counted the total number of gap days per ID but that was inappropriate because I need to indentify patients who have a distinct gap >=4 days, and not patients who overall have missed medication more than 4 days over the period. Any insight would be warmly appreciated ! Thank you data have; input ID $ day1 day2 day3 day4 day5 day6 day7 day8 day9 day10 day11 day12; datalines ; a 1 1 1 0 0 0 0 0 0 0 0 1 b 1 1 0 0 1 1 1 0 0 0 0 0 c 1 0 1 1 1 1 1 1 0 0 0 0 d 1 1 1 0 0 1 1 0 0 0 1 1 run; data want; input ID $ gap gap_date $; datalines ; a 1 day4 b 1 day8 c 1 day9 d 0 run;
... View more