I'm working on a birth cohort analysis of a 20 year administrative dataset with moms and babies. I'm attempting to do something easy, but cannot figure out how to define weeks of pregnancy to identify trimester 1, trimester 2, and trimester 3 critical windows of susceptibility. I do not have estimated last menstrual period, but only admission_date (date of hospital delivery) and numeric variable for gestation_weeks (20 weeks to 44weeks). How do I work backwards to subtract admission_date from gestation_weeks to then use to define trimester divisions: 1-13 weeks (trimester 1); 14-26 weeks (trimester 2); and >= 27 weeks (trimester 3)?
Here's something to get started with:
data _null_;
admission_date = '14Nov2020'd;
gestation_weeks = 44;
conception_date = intnx('WEEK', admission_date, -gestation_weeks, 'B');
format admission_date conception_date date9.;
put _all_;
run;
I've defined a conception date, then you can use INTNX again to get trimesters.
Here's something to get started with:
data _null_;
admission_date = '14Nov2020'd;
gestation_weeks = 44;
conception_date = intnx('WEEK', admission_date, -gestation_weeks, 'B');
format admission_date conception_date date9.;
put _all_;
run;
I've defined a conception date, then you can use INTNX again to get trimesters.
In addition using INTNX as above, you could also compute dates like this:
end_of_trimester1 = conception_date + 7*13;
This is very helpful! And helps me get all the way through the calculation. With sincere gratitude!
This worked!!! So, so grateful to SASKiwi for helping me think through this. I was close, just couldn't get there on my own.
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!
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.