<?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 Single record from multiple records while keeping flags in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888562#M43429</link>
    <description>&lt;P&gt;I have a table that provides multiple customer records with multiple flags (1,0) for product items, however only 1 flag is present per record. I'd like to create a single record with the customer id and all of the product flags&lt;/P&gt;&lt;P&gt;Have:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer ID&lt;/TD&gt;&lt;TD&gt;Bananas&lt;/TD&gt;&lt;TD&gt;Apples&lt;/TD&gt;&lt;TD&gt;Cherries&lt;/TD&gt;&lt;TD&gt;Oranges&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Wed, 09 Aug 2023 13:27:09 GMT</pubDate>
    <dc:creator>lawpaw</dc:creator>
    <dc:date>2023-08-09T13:27:09Z</dc:date>
    <item>
      <title>Single record from multiple records while keeping flags</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888562#M43429</link>
      <description>&lt;P&gt;I have a table that provides multiple customer records with multiple flags (1,0) for product items, however only 1 flag is present per record. I'd like to create a single record with the customer id and all of the product flags&lt;/P&gt;&lt;P&gt;Have:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Customer ID&lt;/TD&gt;&lt;TD&gt;Bananas&lt;/TD&gt;&lt;TD&gt;Apples&lt;/TD&gt;&lt;TD&gt;Cherries&lt;/TD&gt;&lt;TD&gt;Oranges&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Want:&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;123&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 09 Aug 2023 13:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888562#M43429</guid>
      <dc:creator>lawpaw</dc:creator>
      <dc:date>2023-08-09T13:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Single record from multiple records while keeping flags</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888563#M43430</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
    class customerID;
    var bananas apples cherries oranges;
    output out=want max=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2023 13:30:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888563#M43430</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-09T13:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Single record from multiple records while keeping flags</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888588#M43432</link>
      <description>&lt;P&gt;May want to learn to search the forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think we get this, or a very similar question, about every 4 months (possibly related to some professor's teaching schedule)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will say that your desired result does not show "all the flags" because it doesn't show the 0 value "flags". Rephrasing to "I want the maximum value as the 1 valued flags indicates something of interest and 0 otherwise"&amp;nbsp; is more precise and leads to coding solutions like &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also don't need to create a data set to get than information. The Procedures Report and Tabulate will show that result.&lt;/P&gt;
&lt;PRE&gt;proc tabulate data=have;
   class customerid;
   var apples bananas cherries oranges;
   table customerid,
         (apples bananas cherries oranges)*max=''
         ;
run;

Proc report data=have;
   columns customerid apples bananas cherries oranges;
   define customerid/group;
   define apples/ max;
   define bananas / max;
   define cherries/ max;
   define oranges / max;
run;
&lt;/PRE&gt;
&lt;P&gt;For some things you may even find in handier to reshape the data so that you have a&amp;nbsp; variable "Fruit" that has values like&amp;nbsp; "Apple" "Banana" "Cherry" and "Orange".&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2023 15:09:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Single-record-from-multiple-records-while-keeping-flags/m-p/888588#M43432</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-08-09T15:09:16Z</dc:date>
    </item>
  </channel>
</rss>

