<?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: Collate variable names to new variable if hit in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728743#M38407</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Massive appreciation&amp;nbsp;appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 13:20:57 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-03-24T13:20:57Z</dc:date>
    <item>
      <title>Collate variable names to new variable if hit</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728703#M38398</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wonder if you can help. I'm trying to create a new variable which brings in variable names where they equal 1.&lt;/P&gt;&lt;P&gt;For example Reason is the variable I want to create.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Application_number&lt;/TD&gt;&lt;TD&gt;A&lt;/TD&gt;&lt;TD&gt;B&lt;/TD&gt;&lt;TD&gt;C&lt;/TD&gt;&lt;TD&gt;Reason&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5002&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;A,B&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5003&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5004&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;TD&gt;C&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5005&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;A,B,C&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried a VNAME but could only get it to bring in 1 hit. My data source has 49 variables that could have a possible 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Dan&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 10:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728703#M38398</guid>
      <dc:creator>danhopkinslewis</dc:creator>
      <dc:date>2021-03-24T10:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Collate variable names to new variable if hit</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728710#M38402</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input Application_number A B C;
datalines;
5002 1 1 0 
5003 1 1 1 
5004 0 0 1 
5005 1 1 1 
;

data want;
   set have;
   array rr A B C;
   length Reason $ 100;
   do over rr;
      if rr then Reason = catx(',', Reason, vname(rr));
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Application_number  A  B  C  Reason 
5002                1  1  0  A,B 
5003                1  1  1  A,B,C 
5004                0  0  1  C 
5005                1  1  1  A,B,C &lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Mar 2021 10:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728710#M38402</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-03-24T10:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: Collate variable names to new variable if hit</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728712#M38404</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351225"&gt;@danhopkinslewis&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wonder if you can help. I'm trying to create a new variable which brings in variable names where they equal 1.&lt;/P&gt;
&lt;P&gt;For example Reason is the variable I want to create.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Application_number&lt;/TD&gt;
&lt;TD&gt;A&lt;/TD&gt;
&lt;TD&gt;B&lt;/TD&gt;
&lt;TD&gt;C&lt;/TD&gt;
&lt;TD&gt;Reason&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5002&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;A,B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5003&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;A,B,C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5004&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;TD&gt;C&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5005&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;A,B,C&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried a VNAME but could only get it to bring in 1 hit. My data source has 49 variables that could have a possible 1.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I curious, what could you possibly do with a string such as one you are trying to create, if it has 49 different possible variables? What benefits would there be, compared to working with the 0/1 variables?&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:03:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728712#M38404</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-24T11:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Collate variable names to new variable if hit</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728721#M38405</link>
      <description>&lt;P&gt;Works a treat&amp;nbsp; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;massive appreciation sent your way.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728721#M38405</guid>
      <dc:creator>danhopkinslewis</dc:creator>
      <dc:date>2021-03-24T11:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Collate variable names to new variable if hit</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728743#M38407</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Massive appreciation&amp;nbsp;appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 13:20:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Collate-variable-names-to-new-variable-if-hit/m-p/728743#M38407</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-03-24T13:20:57Z</dc:date>
    </item>
  </channel>
</rss>

