<?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 Observations Selection in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672850#M23480</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with the following structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="exposure dataset structure.JPG" style="width: 812px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47739iDA2FB67EFE201391/image-size/large?v=v2&amp;amp;px=999" role="button" title="exposure dataset structure.JPG" alt="exposure dataset structure.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is keep only those observations with a day_01 to day_05 value of "1" for any day between the exposure_start and exposure_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to do this for each Participant_ID. The exposure_start and exposure_end values are unique to each participant_id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for this sample dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input WELL_ID DAY_01 DAY_02 DAY_03 DAY_04 DAY_05 EXPOSURE_START $ EXPOSURE_END $ PARTICIPANT_ID;
	FORMAT WELL_ID z14.;
	datalines;
		01133244410000 0 0 1 0 0 DAY_01 DAY_05 1
		02019220960000 0 0 0 0 0 DAY_01 DAY_05 1
		07167297020000 1 0 0 0 0 DAY_01 DAY_05 1
		17067210480000 0 0 0 0 0 DAY_01 DAY_05 1
		34000000000000 0 0 0 0 0 DAY_01 DAY_05 1
		34001200010000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200020000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200030000 0 0 0 1 0 DAY_02 DAY_04 2
		34001200040000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200050000 0 0 0 0 0 DAY_02 DAY_04 2
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jul 2020 14:29:04 GMT</pubDate>
    <dc:creator>JJ_83</dc:creator>
    <dc:date>2020-07-28T14:29:04Z</dc:date>
    <item>
      <title>Observations Selection</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672850#M23480</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset with the following structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="exposure dataset structure.JPG" style="width: 812px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/47739iDA2FB67EFE201391/image-size/large?v=v2&amp;amp;px=999" role="button" title="exposure dataset structure.JPG" alt="exposure dataset structure.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to do is keep only those observations with a day_01 to day_05 value of "1" for any day between the exposure_start and exposure_end.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to do this for each Participant_ID. The exposure_start and exposure_end values are unique to each participant_id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code for this sample dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input WELL_ID DAY_01 DAY_02 DAY_03 DAY_04 DAY_05 EXPOSURE_START $ EXPOSURE_END $ PARTICIPANT_ID;
	FORMAT WELL_ID z14.;
	datalines;
		01133244410000 0 0 1 0 0 DAY_01 DAY_05 1
		02019220960000 0 0 0 0 0 DAY_01 DAY_05 1
		07167297020000 1 0 0 0 0 DAY_01 DAY_05 1
		17067210480000 0 0 0 0 0 DAY_01 DAY_05 1
		34000000000000 0 0 0 0 0 DAY_01 DAY_05 1
		34001200010000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200020000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200030000 0 0 0 1 0 DAY_02 DAY_04 2
		34001200040000 0 0 0 0 0 DAY_02 DAY_04 2
		34001200050000 0 0 0 0 0 DAY_02 DAY_04 2
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 14:29:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672850#M23480</guid>
      <dc:creator>JJ_83</dc:creator>
      <dc:date>2020-07-28T14:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Observations Selection</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672858#M23481</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set have;
	array d(*) day_01-day_05;
	exp_start=input(scan(exposure_start,2,'_'),2.);
	exp_end=input(scan(exposure_end,2,'_'),2.);
	do i=exp_start to exp_end;
	    if d(i)=1 then do; 
			output; 
			leave;
		end;
	end;
	drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jul 2020 14:38:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672858#M23481</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-28T14:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: Observations Selection</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672961#M23485</link>
      <description>&lt;P&gt;Wow, this works perfectly! Thank you so much!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jul 2020 19:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Observations-Selection/m-p/672961#M23485</guid>
      <dc:creator>JJ_83</dc:creator>
      <dc:date>2020-07-28T19:55:43Z</dc:date>
    </item>
  </channel>
</rss>

