<?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: drop the duplicate columns with sas in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135314#M36628</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you just build a macro variable with all variables that should be dropped? And then just rewrite you table using a accumulated drop statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=dicoat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by title;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set dicoat end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length dropvar $1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain dropvar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by title;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not first.title then dropvar = catx(' ',dropvar,nomvar);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last then call symput('dropvar',trim(dropvar));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data aat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set aat(drop=&amp;amp;DROPVAR.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Jun 2014 09:31:47 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2014-06-10T09:31:47Z</dc:date>
    <item>
      <title>drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135311#M36625</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;I'm dropping duplcated columns from my tables with this code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Step by step explanation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;I'm creating the table toto through a select on the table dicoat.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Once created, I'm having a datastep &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;However the while loop is not recognized. for the datastep. The rule should be if there are duplicate columns, then drop the duplicate columns&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;and do that until the counting is superior or equal to one.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;The issue is that the&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt; while loop is n&lt;/SPAN&gt;ot recognized. &lt;STRONG&gt;Edited&lt;/STRONG&gt;: Is it allowed to put a proc sql within a loop like that?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Why? &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Am I doing something wrong?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; background: transparent; font-size: 14px; background-color: #ffffff; font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-position: initial;"&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; sql&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;create&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;table&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; toto &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; min&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;nomvar&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; nomvar&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;title&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; counting&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; dicoat&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;group&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;title&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;having&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; count&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;title&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000; background: transparent;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data work&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;toto&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; background-position: initial;"&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;set toto;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&amp;nbsp; do &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;while&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;counting&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000; background: transparent;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;proc&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; sql&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;delete&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; dicoat &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;where&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; nomvar &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;in&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; nomvar &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; toto&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;);&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;insert&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;into&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; toto&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;select&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; min&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;nomvar&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; nomvar&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;count&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;title&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;as&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;counting&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; dicoat&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;group&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;by&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;title&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;having&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; count&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;(&lt;SPAN style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;title&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000; background: transparent;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt; run&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;file&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; tempf&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;set&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; toto &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;end&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;lastobs&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; _n_&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000; background: transparent;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; put &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000; background: transparent;"&gt;"data aat;set aat (drop="&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;put var &lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;/;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;if&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; lastobs &lt;/SPAN&gt;&lt;SPAN class="kwd" style="color: #00008b; background: transparent;"&gt;then&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt; put &lt;/SPAN&gt;&lt;SPAN class="str" style="color: #800000; background: transparent;"&gt;");run;"&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;run&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;%&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;inc tempf&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;SPAN class="pln" style="background: transparent;"&gt;&lt;BR /&gt;&lt;BR /&gt;filename tempf clear&lt;/SPAN&gt;&lt;SPAN class="pun" style="background: transparent;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 07:47:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135311#M36625</guid>
      <dc:creator>andy_wk</dc:creator>
      <dc:date>2014-06-10T07:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135312#M36626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not really seeing what you try to achieve, some sample data can be of help - along with a more extensive description of your problem.&lt;/P&gt;&lt;P&gt;And no, you can't mix SQL and data step in that way. You could call SQL from within a data step using call execute, but I can't tell if that's the right way to go for you. My gut feeling is that there is a simpler way to do this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 08:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135312#M36626</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-06-10T08:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135313#M36627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok LinusH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table called dicoat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It will be something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data dicoat;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;input title$ nomvar$;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;cards;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aty var12&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;zat var13&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;zat var52&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aty var55&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;zat var98&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;att var100&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see, I'm trying to remove the duplicate from &lt;STRONG&gt;dicoat &lt;/STRONG&gt;with my code recursively until dicoat has only one &lt;STRONG&gt;nomvar&lt;/STRONG&gt; and one &lt;STRONG&gt;title&lt;/STRONG&gt;. In the same time, I need to put all the duplcate into a macro variable as I need to use that macrovariable&lt;/P&gt;&lt;P&gt;to drop the columns in the table aat as I've put in my code above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;aat&lt;/STRONG&gt; before transformation&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;var12 &lt;STRONG&gt;&lt;STRONG&gt;var13 &lt;STRONG&gt;var52 &lt;STRONG&gt;var55&amp;nbsp; &lt;STRONG&gt;var98 &lt;STRONG&gt;var100&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;aat &lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;after columns drop&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;var12 &lt;STRONG&gt;&lt;STRONG&gt;var13 &lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;STRONG&gt;var100&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it is clearer. If not, let me know.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 08:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135313#M36627</guid>
      <dc:creator>andy_wk</dc:creator>
      <dc:date>2014-06-10T08:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135314#M36628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't you just build a macro variable with all variables that should be dropped? And then just rewrite you table using a accumulated drop statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=dicoat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; by title;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set dicoat end=last;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length dropvar $1000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain dropvar;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by title;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if not first.title then dropvar = catx(' ',dropvar,nomvar);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last then call symput('dropvar',trim(dropvar));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options symbolgen;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data aat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set aat(drop=&amp;amp;DROPVAR.);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 09:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135314#M36628</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-06-10T09:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135315#M36629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks LinusH.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me have a look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Jun 2014 09:37:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135315#M36629</guid>
      <dc:creator>andy_wk</dc:creator>
      <dc:date>2014-06-10T09:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135316#M36630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the example you showed -&amp;nbsp; I see zat&amp;nbsp; appears twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You'd like to only see zat once, correct? In that case, how do you decide which row to delete? var13 or var52?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 01:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135316#M36630</guid>
      <dc:creator>JBerry</dc:creator>
      <dc:date>2014-06-11T01:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135317#M36631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't care which row appears, try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table no_dupes as&lt;/P&gt;&lt;P&gt;&amp;nbsp; select *&lt;/P&gt;&lt;P&gt;&amp;nbsp; from (select *,monotonic() as rn from dicoat) AS rs&lt;/P&gt;&lt;P&gt;&amp;nbsp; group by title&lt;/P&gt;&lt;P&gt;&amp;nbsp; having rn=min(rn);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 01:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135317#M36631</guid>
      <dc:creator>JBerry</dc:creator>
      <dc:date>2014-06-11T01:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: drop the duplicate columns with sas</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135318#M36632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jberry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does not matter , which variables to delete. However, as I have many , I need one to recursively delete them until I have only one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does it make sense?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 08:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/drop-the-duplicate-columns-with-sas/m-p/135318#M36632</guid>
      <dc:creator>andy_wk</dc:creator>
      <dc:date>2014-06-11T08:19:18Z</dc:date>
    </item>
  </channel>
</rss>

