<?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 to group and delete observations (ID) with any missing values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414840#M67533</link>
    <description>&lt;P&gt;Perhaps something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select name into :varlist separated by ',' from dictionary.columns where libname='WORK' and memname='HAVE' ;
   create table want as
   select * from have
   where ID not in 
   (select ID from have where Visit=1 and weight &amp;lt; 200
                           or cmiss(&amp;amp;varlist) &amp;gt; 0);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 20 Nov 2017 14:04:00 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-11-20T14:04:00Z</dc:date>
    <item>
      <title>How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414719#M67523</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a data set to help explain my question. In my&amp;nbsp;example, researchers are trying to understand the impact of different types of&amp;nbsp;&lt;/P&gt;&lt;P&gt;Diet plans on change in BMI over 3 study visits.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ID Visit&amp;nbsp; Sex&amp;nbsp; Age&amp;nbsp; &amp;nbsp;Height&amp;nbsp; &amp;nbsp;Weight (lbs)&amp;nbsp; &amp;nbsp; &amp;nbsp;Diet (Type)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 23&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.75&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;200&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 18&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 300&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 1&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1.5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 195&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 24&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.75&amp;nbsp; &amp;nbsp; &amp;nbsp; 180&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 19&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;321&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 2&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; 29&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; 25&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.75&amp;nbsp; &amp;nbsp; &amp;nbsp;170&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2.1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 280&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; 3&amp;nbsp; &amp;nbsp; &amp;nbsp;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1.5&amp;nbsp; &amp;nbsp; &amp;nbsp; 135&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My question is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- How can I exclude people who&amp;nbsp;weigh below a certain cutoff at visit=1 (for example if I want to exclude all people who weigh &amp;lt;200 lbs &lt;STRONG&gt;at visit 1&lt;/STRONG&gt;).&amp;nbsp; The resulting data set would only have ID1 &amp;amp; ID2.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;then&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- How I can remove ID that have any missing data (missing data could be for any of the variables and for any of the study visits).&amp;nbsp; In&amp;nbsp;this scenario, the resulting data set would only have information for 3 study visits of ID1 (since the other ID have missing values)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My assumption is that I can use proc sql&amp;nbsp;to group and delete ID with missing data but I have no idea how to do it. I appreciate any help you can give me.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Nov 2017 22:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414719#M67523</guid>
      <dc:creator>lousam</dc:creator>
      <dc:date>2017-11-19T22:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414763#M67524</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID Visit Sex Age Height Weight Diet;
datalines;
1 1 0 23 1.75 200 0
2 1 0 18 2.1 300 1
3 1 1 .  1.5 195 2
1 2 0 24 1.75 180 0
2 2 0 19 . 321 1
3 2 1 29 1.5 . 2
1 3 0 25 1.75 170 0
2 3 0 . 2.1 280 1
3 3 1 30 1.5 135 2
;

proc sql;
   create table want as
   select * from have
   where ID not in 
   (select ID from have where Visit=1 and weight &amp;lt; 200
                           or cmiss(Visit, Sex, Age, Height, Weight, Diet) &amp;gt; 0);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 07:15:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414763#M67524</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-20T07:15:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414792#M67529</link>
      <description>&lt;P&gt;Map the data into industry standard data models = SDTM/ADaM.&amp;nbsp; The reason being if you mapped into ADaM format, one of the sets of variables is baseline and change from baseline.&amp;nbsp; You would follow the logic of:&lt;/P&gt;
&lt;P&gt;select baseline record (if this is visit 1 then simple, but you may have repeats, multiples on the same date etc.)&lt;/P&gt;
&lt;P&gt;merge this record back to original data based on ID&lt;/P&gt;
&lt;P&gt;Then baseline value appears on all records and you can simply filter with where or if.&lt;/P&gt;
&lt;P&gt;Not typing in test data - see other posts for how to post test data, so this code is just a guess:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  A.*,
          B.WEIGHT as BASE
  from    HAVE A
  left join (select * from HAVE where VISIT=1) B
  on      A.ID=B.ID;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 10:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414792#M67529</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-20T10:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414832#M67531</link>
      <description>&lt;P&gt;I am trying to apply the concept to a large data set with ~50 variables. Is there a way to do this [for instance using cmiss ()] without listing all of the variables in the code? The variables are all numeric. Thanks for the help&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 13:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414832#M67531</guid>
      <dc:creator>lousam</dc:creator>
      <dc:date>2017-11-20T13:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414838#M67532</link>
      <description>&lt;P&gt;Good idea to provide:&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Test data in the form of a datastep.&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;&lt;/U&gt;And required output.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have lots of variables, you should really follow my post and convert the data to an industry standard, you will find your life much easier.&amp;nbsp; For this problem the simplest way is to normalise the data, i.e. put it going down the page, then apply my logic (and if necessary transpose up again), consider:&lt;BR /&gt;USUBJID PARAM&amp;nbsp; &amp;nbsp;LBSTRESN&lt;/P&gt;
&lt;P&gt;XYZ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WEIGHT 123.4&lt;/P&gt;
&lt;P&gt;XYZ&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HEIGHT&amp;nbsp; 23&lt;/P&gt;
&lt;P&gt;ABC&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; WEIGHT ...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can then apply my logic very simply to all the data and just add PARAM to the merge items.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could do it in a transpose dataset as well, but it becomes far more complicated, you would need to merge on all the records for each of the variables, then do an array comparison to output a new array of results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Transpose down&lt;/P&gt;
&lt;P&gt;Do merge and calcuation&lt;/P&gt;
&lt;P&gt;Transpose up&lt;/P&gt;
&lt;P&gt;Far simpler.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 14:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414838#M67532</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-20T14:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to group and delete observations (ID) with any missing values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414840#M67533</link>
      <description>&lt;P&gt;Perhaps something like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select name into :varlist separated by ',' from dictionary.columns where libname='WORK' and memname='HAVE' ;
   create table want as
   select * from have
   where ID not in 
   (select ID from have where Visit=1 and weight &amp;lt; 200
                           or cmiss(&amp;amp;varlist) &amp;gt; 0);
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Nov 2017 14:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-group-and-delete-observations-ID-with-any-missing-values/m-p/414840#M67533</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-20T14:04:00Z</dc:date>
    </item>
  </channel>
</rss>

