<?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: Make sure every observations has been assigned to a subset in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232601#M5755</link>
    <description>&lt;P&gt;One simple way is to look at the log to find out if the counts from the parent dataset match with the sum of the subset datasets, that is if the subsets themselves are datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another easy was is that if you are using a variable that identifies where the subset records are written to, you may do a frequency of that variable and tally them up with the subsets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third way I can think of is that if there is a key, you can write a merge to see where each record has ended up by merging with the key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could possibly write a proc compare but I would guess one of the above options would have already displayed the information you are looking for...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck...!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Nov 2015 00:28:20 GMT</pubDate>
    <dc:creator>kannand</dc:creator>
    <dc:date>2015-11-01T00:28:20Z</dc:date>
    <item>
      <title>Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232588#M5754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a questions here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have just written code that assigns each patient in your data set to &lt;STRONG&gt;one of four mutually exclusive subsets&lt;/STRONG&gt;.&amp;nbsp; &lt;STRONG&gt;How would you check to make sure that every patient has been assigned to a subset and none are in more than one?&amp;nbsp;&lt;/STRONG&gt; Knowing that every patient should fall into one of these categories, how would you handle those that don't?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone has know how to solve this? Even some idea are okay.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;</description>
      <pubDate>Sat, 31 Oct 2015 21:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232588#M5754</guid>
      <dc:creator>echo991</dc:creator>
      <dc:date>2015-10-31T21:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232601#M5755</link>
      <description>&lt;P&gt;One simple way is to look at the log to find out if the counts from the parent dataset match with the sum of the subset datasets, that is if the subsets themselves are datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another easy was is that if you are using a variable that identifies where the subset records are written to, you may do a frequency of that variable and tally them up with the subsets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third way I can think of is that if there is a key, you can write a merge to see where each record has ended up by merging with the key.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could possibly write a proc compare but I would guess one of the above options would have already displayed the information you are looking for...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good Luck...!!!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2015 00:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232601#M5755</guid>
      <dc:creator>kannand</dc:creator>
      <dc:date>2015-11-01T00:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232611#M5756</link>
      <description>&lt;P&gt;To get a list of the potentially problematic cases, try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select patientID, Subset
from myData
group by patientID
having count(distinct Subset) ne 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;How to correct those cases will depend on the meaning of those subsets. You could do it by hand if the number is small or have to refine your assignment procedure if there are too many.&lt;/P&gt;</description>
      <pubDate>Sun, 01 Nov 2015 02:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232611#M5756</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-01T02:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232616#M5757</link>
      <description>Hi PG,&lt;BR /&gt;I can't understand your writing totally, what does select subset mean?&lt;BR /&gt;If I have a dataset named myData, and all patients id in myData has set in to one of four mutually exclusive subsets (A, B, C, D), how could I make sure every id has in one of four subsets, no duplicate and no obsence?&lt;BR /&gt;Could you help me more, please?&lt;BR /&gt;&lt;BR /&gt;Many thanks,&lt;BR /&gt;Chen</description>
      <pubDate>Sun, 01 Nov 2015 03:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232616#M5757</guid>
      <dc:creator>echo991</dc:creator>
      <dc:date>2015-11-01T03:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232617#M5758</link>
      <description>&lt;P&gt;My code supposes that your dataset myData contains two variables. The variable patientID identifies every patient uniquely. The variable Subset would take values A, B, C, or D. The SQL query will print the list of records of patients and their subsets only for patients with more than one subset, or no subset at all (missing subset value).&lt;/P&gt;
&lt;P&gt;Instead of printing the records, you may create a new dataset with the troublesome records with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table myTroubleData as
select *
from myData
group by patientID
having count(distinct subset) ne 1;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Nov 2015 03:54:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232617#M5758</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-11-01T03:54:26Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232630#M5759</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (condition one) then output dataset1;
else if (condition two) then output dataset2;
else if (condition three) then output dataset3;
else if (condition four) then output dataset4;
else abort;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 01 Nov 2015 11:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232630#M5759</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-11-01T11:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: Make sure every observations has been assigned to a subset</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232754#M5763</link>
      <description>&lt;P&gt;Not effecient by any means but relatively easy to understand:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data= have;&lt;/P&gt;
&lt;P&gt;tables id * CodedVariable / norow nocol nopercent;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Table with any ID and 2 or more values for the recode are problematic.&lt;/P&gt;
&lt;P&gt;Then&lt;/P&gt;
&lt;P&gt;proc print data=have;&lt;/P&gt;
&lt;P&gt;where id in (&amp;lt;list the id values from above here&amp;gt;);&lt;/P&gt;
&lt;P&gt;var id &amp;lt;and list of variables used in the recode&amp;gt; CodedVariable;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;That should give an idea of which rule(s) may not have been applied correctly.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Nov 2015 15:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Make-sure-every-observations-has-been-assigned-to-a-subset/m-p/232754#M5763</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-11-02T15:45:37Z</dc:date>
    </item>
  </channel>
</rss>

