BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jdr1
Obsidian | Level 7

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)? 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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.

View solution in original post

4 REPLIES 4
SASKiwi
PROC Star

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.

PaigeMiller
Diamond | Level 26

In addition using INTNX as above, you could also compute dates like this:

 

end_of_trimester1 = conception_date + 7*13;

 

--
Paige Miller
jdr1
Obsidian | Level 7

This is very helpful! And helps me get all the way through the calculation. With sincere gratitude! 

jdr1
Obsidian | Level 7

This worked!!! So, so grateful to SASKiwi for helping me think through this. I was close, just couldn't get there on my own. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1568 views
  • 2 likes
  • 3 in conversation