<?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 merge two varlists in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242553#M6319</link>
    <description>&lt;P&gt;A few more considerations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does capitalization matter? &amp;nbsp;If one list contains "name" and the other contains "Name", are those duplicates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could duplicates exist within just one of the lists? &amp;nbsp;For example, is it possible that &amp;amp;alist = name height name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have seen this problem addressed in a SAS Press book. &amp;nbsp;Macro Language Magic has a chapter on generating text. &amp;nbsp;But I would hesitate to just copy a section of copyrighted material here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
    <pubDate>Sat, 09 Jan 2016 15:52:59 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-01-09T15:52:59Z</dc:date>
    <item>
      <title>How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242534#M6313</link>
      <description>&lt;P&gt;How to merge Alist and Blist to have Clist containing all variables in two mentioned lists?&lt;/P&gt;&lt;P&gt;%let Alist = x1 x2 x3 x4 x5 ;&lt;/P&gt;&lt;P&gt;%let Blist = x4 x5 x6 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 13:02:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242534#M6313</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T13:02:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242536#M6314</link>
      <description>%let clist = &amp;amp;alist. &amp;amp;blist.;</description>
      <pubDate>Sat, 09 Jan 2016 13:36:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242536#M6314</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-09T13:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242541#M6315</link>
      <description>&lt;P&gt;I guess you wrote "merge" and not "concatenate" because you would like your "Clist" to be free of duplicates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not aware of an easy solution to this task, but a quick search on the web brought up this discussion:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/33640976/how-do-i-deduplicate-words-in-a-character-variable" target="_blank"&gt;http://stackoverflow.com/questions/33640976/how-do-i-deduplicate-words-in-a-character-variable&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The solution provided by user "Chris J" promises to deduplicate the concatenated list suggested by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt;, but I haven't tested it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it depends on how you are going to use Clist, whether you really need to have it duplicate free. In DROP or KEEP statements (or dataset options), for example, duplicate variable names do no harm.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 14:20:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242541#M6315</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-09T14:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242543#M6316</link>
      <description>&lt;P&gt;Thanks Reeza for your reply.Let me clarify myself. I want to avoid duplicated variables as well.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 14:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242543#M6316</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T14:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242544#M6317</link>
      <description>&lt;P&gt;many thanks for your reply but i need to avoid duplicated variables in new varlist.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 14:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242544#M6317</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T14:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242552#M6318</link>
      <description>Do you need to maintain any particular order of the variable names in the list?  Do the variables mentioned in the lists exist, or need to exist, or are they just arbitrary SAS-names?</description>
      <pubDate>Sat, 09 Jan 2016 15:40:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242552#M6318</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2016-01-09T15:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242553#M6319</link>
      <description>&lt;P&gt;A few more considerations ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does capitalization matter? &amp;nbsp;If one list contains "name" and the other contains "Name", are those duplicates?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could duplicates exist within just one of the lists? &amp;nbsp;For example, is it possible that &amp;amp;alist = name height name?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I have seen this problem addressed in a SAS Press book. &amp;nbsp;Macro Language Magic has a chapter on generating text. &amp;nbsp;But I would hesitate to just copy a section of copyrighted material here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 15:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242553#M6319</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-01-09T15:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242554#M6320</link>
      <description>&lt;P&gt;Hi -&amp;nbsp;&lt;/P&gt;&lt;P&gt;- order does not matter, although preferable&amp;nbsp;&lt;/P&gt;&lt;P&gt;- yes variables in the list exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 15:56:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242554#M6320</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T15:56:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242556#M6321</link>
      <description>&lt;P&gt;Hi - thanks for your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Capitalization does not matter.&lt;/P&gt;&lt;P&gt;- duplication in one list is not possible.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 15:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242556#M6321</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T15:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242559#M6322</link>
      <description>&lt;P&gt;Here's an approach ... you would need to apply it to both ALIST and BLIST. &amp;nbsp;You would clearly need to encapsulate this inside a macro definition as well since it uses %DO and %IF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let clist=%upcase(&amp;amp;alist);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%do i=1 %to %sysfunc(countw(&amp;amp;blist));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;%let onevar = %upcase(%scan(&amp;amp;blist, &amp;amp;i));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;%if %index(%str( &amp;amp;clist ), %str( &amp;amp;onevar ))=0 %then %let clist = &amp;amp;clist &amp;amp;onevar;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 16:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242559#M6322</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-01-09T16:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge two varlists</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242560#M6323</link>
      <description>&lt;P&gt;&lt;SPAN class="login-bold"&gt;Astounding ,&amp;nbsp;&lt;/SPAN&gt;Thanks soooooo much!!!!! It works very well .....&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jan 2016 16:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/How-to-merge-two-varlists/m-p/242560#M6323</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-09T16:25:39Z</dc:date>
    </item>
  </channel>
</rss>

