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. 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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