<?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: How do i drop genotypes with missing data in a repeated measures experiment? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354227#M64094</link>
    <description>&lt;P&gt;Proc SQL YAY!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from have
where id in (select id from have group by id having count(distinct year) &amp;gt;=5);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Modified&amp;nbsp;as you wish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2017 18:35:08 GMT</pubDate>
    <dc:creator>thomp7050</dc:creator>
    <dc:date>2017-04-27T18:35:08Z</dc:date>
    <item>
      <title>How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354218#M64093</link>
      <description>&lt;P&gt;I have a data set with 337 genotypes that were analyzed for disease resistance over an 11 year period. The first few lines looks like this:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/8587i69A59ADF1F363E17/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="sas help.png" title="sas help.png" width="181" height="156" /&gt;&lt;/P&gt;&lt;P&gt;However, not every genotype was tested in every year. I need to use only the genotypes that were tested in at least 5 of the 11 years. How can I create a dataset with only these genotypes?&amp;nbsp;I can manually go and count them, then use the data step (I show below how I did this) to pick out the genotypes I want, but there's got to be a better way. I've been recommended to use PROC SQL but I&amp;nbsp;can't work out how to tell it what I need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Suggestions? Thank you in advance! (I'm using SAS 9.4)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the data step I mentioned:&lt;/P&gt;&lt;P&gt;data Potato_Blight4;&lt;BR /&gt;set Potato_Blight3;&lt;BR /&gt;if Gen = "FRASER" then output;&lt;BR /&gt;if Gen="I.HARDY" then output;&lt;BR /&gt;if Gen="IWA" then output;&lt;BR /&gt;if Gen="KARAKA" then output;&lt;BR /&gt;if Gen="KIWITEA" then output;&lt;BR /&gt;if Gen="P.DELL" then output;&lt;BR /&gt;if Gen="R.BURBANK" then output;&lt;BR /&gt;if Gen="R.RASCAL" then output;&lt;BR /&gt;if Gen="RUA" then output;&lt;BR /&gt;if Gen="W.DELIGHT" then output;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=Potato_Blight4; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And this is the proc sql I've tried but I know it's wrong:&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table Potato_Blight_5yrs as&lt;BR /&gt;select gen&lt;BR /&gt;from Potato_Blight2&lt;BR /&gt;where y in year &amp;gt;5&lt;BR /&gt;group by gen, year&lt;BR /&gt;having sum(value='')=0;&lt;BR /&gt;/* having count(*) &amp;gt; 4; */&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 17:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354218#M64093</guid>
      <dc:creator>jchitw12</dc:creator>
      <dc:date>2017-04-27T17:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354227#M64094</link>
      <description>&lt;P&gt;Proc SQL YAY!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select * from have
where id in (select id from have group by id having count(distinct year) &amp;gt;=5);
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Modified&amp;nbsp;as you wish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354227#M64094</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-27T18:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354232#M64095</link>
      <description>&lt;P&gt;Keep it simple:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as
select * 
from have 
group by gen
having count(distinct year) &amp;gt;= 5;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:44:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354232#M64095</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-27T18:44:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354234#M64096</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;unfortunately the simpler code as written doesn't work. &amp;nbsp;Can you rewrite using the data step here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input obs_in year gen $ rep y;
cards;
7 1983 060.1 1 9
36 1983 060.1 2 9
46 1983 060.1 3 9
71 1983 060.1 4 8
81 1983 060.1 5 9
;
run;


proc sql;
create table want as
select * 
from have 
group by gen
having count(distinct(year)) &amp;gt;= 5;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354234#M64096</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-27T18:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354246#M64097</link>
      <description>&lt;P&gt;Your data shows a single genotype measured on a single year (1983). So it hasn't been measured over 5 years or more and is thus not kept. Doesn't that agree&amp;nbsp;with your request?&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 19:00:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354246#M64097</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-04-27T19:00:21Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354247#M64098</link>
      <description>&lt;P&gt;LOL I guess you're right!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 19:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354247#M64098</guid>
      <dc:creator>thomp7050</dc:creator>
      <dc:date>2017-04-27T19:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do i drop genotypes with missing data in a repeated measures experiment?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354248#M64099</link>
      <description>&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 19:03:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-i-drop-genotypes-with-missing-data-in-a-repeated-measures/m-p/354248#M64099</guid>
      <dc:creator>jchitw12</dc:creator>
      <dc:date>2017-04-27T19:03:43Z</dc:date>
    </item>
  </channel>
</rss>

