<?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: parity at sampling point in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835789#M330449</link>
    <description>You are right... i wrote the wrong parity.&lt;BR /&gt;Thank you very much for the code, i will just see if i can get it to work!</description>
    <pubDate>Thu, 29 Sep 2022 08:52:25 GMT</pubDate>
    <dc:creator>lone0708</dc:creator>
    <dc:date>2022-09-29T08:52:25Z</dc:date>
    <item>
      <title>parity at sampling point</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835774#M330439</link>
      <description>&lt;P&gt;Hi All,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working with a dataset containing information about dates of bloodsamples in a cohort of women who have been pregnant one or more times. I need to calculate parity of the woman at sampling point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data have;
input woman_id date_of_delivery woman_birth_date sampling date;
datalines;
1 21-dec-2001 01-jan-1971 12-jun-2020
1 01-jan-2003 01-jan-1971 12-jun-2020
1 07-aug-2005 01-jan-1971 12-jun-2020
1 13-jun-2009 01-jan-1971 12-jun-2020
2 07-Jan-2010 15-APR-1970 10-may-2009
2 07-Jan-2010 15-APR-1970 12-may-2021
2 07-Jan-2010 15-APR-1970 14-may-2021
3 26-jan-1980 07-aug-1961 18-jan-1979
3 26-jan-1980 07-aug-1961 20-jan-1979
3 26-jan-1980 07-aug-1961 14-mar-2021
3 26-jan-1980 07-aug-1961 17-mar-2021
3 10-aug-1983 07-aug-1961 18-jan-1979
3 10-aug-1983 07-aug-1961 20-jan-1979
3 10-aug-1983 07-aug-1961 14-mar-2021
3 10-aug-1983 07-aug-1961 17-mar-2021
3 12-sep-1985 07-aug-1961 18-jan-1979
3 12-sep-1985 07-aug-1961 20-jan-1979
3 12-sep-1985 07-aug-1961 14-mar-2021
3 12-sep-1985 07-aug-1961 17-mar-2021
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data WANT; 
input woman_id date_of_delivery woman_birth_date sampling date parity; 
datalines;
1 21-dec-200101-jan-1971 12-jun-2020 4
1 01-jan-2003 01-jan-1971 12-jun-2020 4 
1 07-aug-2005 01-jan-1971 12-jun-2020 4
1 13-jun-2009 01-jan-1971 12-jun-2020 4
2 07-Jan-2010 15-APR-1970 10-may-2009 0
2 07-Jan-2010 15-APR-1970 12-may-2021 1
2 07-Jan-2010 15-APR-1970 14-may-2021 1
3 26-jan-1980 07-aug-1961 18-jan-1979 0
3 26-jan-1980 07-aug-1961 20-jan-1979 0
3 26-jan-1980 07-aug-1961 14-mar-2021 4
3 26-jan-1980 07-aug-1961 17-mar-2021 4
3 10-aug-1983 07-aug-1961 18-jan-1979 0
3 10-aug-1983 07-aug-1961 20-jan-1979 0
3 10-aug-1983 07-aug-1961 14-mar-2021 4
3 10-aug-1983 07-aug-1961 17-mar-2021 4
3 12-sep-1985 07-aug-1961 18-jan-1979 0
3 12-sep-1985 07-aug-1961 20-jan-1979 0
3 12-sep-1985 07-aug-1961 14-mar-2021 4
3 12-sep-1985 07-aug-1961 17-mar-2021 4
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Sep 2022 07:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835774#M330439</guid>
      <dc:creator>lone0708</dc:creator>
      <dc:date>2022-09-29T07:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: parity at sampling point</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835788#M330448</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/338918"&gt;@lone0708&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If "parity" was defined as the number of deliveries (on or) before the sampling date, I would suggest this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select *, (select count(distinct date_of_delivery) from have where woman_id=a.woman_id &amp;amp; date_of_delivery&amp;lt;=a.sampling_date) as parity
from have a;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But for the most recent samples of &lt;FONT face="courier new,courier"&gt;woman_id 3&lt;/FONT&gt; (with three dates of delivery) this yields &lt;FONT face="courier new,courier"&gt;parity=&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/FONT&gt;, not &lt;FONT face="courier new,courier"&gt;4&lt;/FONT&gt;, so I'm not sure I understand your definition correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Sep 2022 08:53:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835788#M330448</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2022-09-29T08:53:56Z</dc:date>
    </item>
    <item>
      <title>Re: parity at sampling point</title>
      <link>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835789#M330449</link>
      <description>You are right... i wrote the wrong parity.&lt;BR /&gt;Thank you very much for the code, i will just see if i can get it to work!</description>
      <pubDate>Thu, 29 Sep 2022 08:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/parity-at-sampling-point/m-p/835789#M330449</guid>
      <dc:creator>lone0708</dc:creator>
      <dc:date>2022-09-29T08:52:25Z</dc:date>
    </item>
  </channel>
</rss>

