<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: calculate weeks between a date and numeric variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698868#M213769</link>
    <description>&lt;P&gt;In addition using INTNX as above, you could also compute dates like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;end_of_trimester1 = conception_date + 7*13;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 14 Nov 2020 11:58:13 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-11-14T11:58:13Z</dc:date>
    <item>
      <title>calculate weeks between a date and numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698752#M213727</link>
      <description>&lt;P&gt;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 &lt;STRONG&gt;admission_date&lt;/STRONG&gt; (date of hospital delivery) and numeric variable for &lt;STRONG&gt;gestation_weeks&lt;/STRONG&gt; (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 &amp;gt;= 27 weeks (trimester 3)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 18:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698752#M213727</guid>
      <dc:creator>jdr1</dc:creator>
      <dc:date>2020-11-13T18:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: calculate weeks between a date and numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698832#M213749</link>
      <description>&lt;P&gt;Here's something to get started with:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;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;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I've defined a conception date, then you can use INTNX again to get trimesters.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 22:32:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698832#M213749</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-13T22:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: calculate weeks between a date and numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698868#M213769</link>
      <description>&lt;P&gt;In addition using INTNX as above, you could also compute dates like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;end_of_trimester1 = conception_date + 7*13;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Nov 2020 11:58:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698868#M213769</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-11-14T11:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: calculate weeks between a date and numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698875#M213772</link>
      <description>&lt;P&gt;This worked!!! So, so grateful to SASKiwi for helping me think through this. I was close, just couldn't get there on my own.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Nov 2020 14:48:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698875#M213772</guid>
      <dc:creator>jdr1</dc:creator>
      <dc:date>2020-11-14T14:48:59Z</dc:date>
    </item>
    <item>
      <title>Re: calculate weeks between a date and numeric variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698876#M213773</link>
      <description>&lt;P&gt;This is very helpful! And helps me get all the way through the calculation. With sincere gratitude!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Nov 2020 14:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/calculate-weeks-between-a-date-and-numeric-variable/m-p/698876#M213773</guid>
      <dc:creator>jdr1</dc:creator>
      <dc:date>2020-11-14T14:50:12Z</dc:date>
    </item>
  </channel>
</rss>

