<?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 drop variables in a do in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846157#M334517</link>
    <description>Thanks but it didn't work.&lt;BR /&gt;In the documentation I didn't see an example with a macrovariable, I don't know if it's me who doesn't understand how to use it</description>
    <pubDate>Thu, 24 Nov 2022 14:17:08 GMT</pubDate>
    <dc:creator>Mathis91</dc:creator>
    <dc:date>2022-11-24T14:17:08Z</dc:date>
    <item>
      <title>How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846148#M334511</link>
      <description>&lt;P&gt;Hello, I want to drop a variable in a dataset which came from a transpose.&lt;/P&gt;&lt;P&gt;The difficulty here is the number of variables to drop : it can change following the number of columns at the end of the transpose.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried this :&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data datasetname;&lt;BR /&gt;set datasetname;&lt;BR /&gt;array date[&amp;amp;Dimension_tbl.];&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;do i=1 to &amp;amp;Dimension_tbl.;&lt;BR /&gt;drop date{i};&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand why it doesn't work. Of course, the &amp;amp;Dimension_tbl. is defined earlier.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846148#M334511</guid>
      <dc:creator>Mathis91</dc:creator>
      <dc:date>2022-11-24T14:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846150#M334512</link>
      <description>&lt;P&gt;A few things.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;The Drop Statement is a complie-time only statement. Meaning that it is not considered during execution of the data step. Therefore it cannot be called in conditional logic.&lt;/LI&gt;
&lt;LI&gt;What does&amp;nbsp;&lt;SPAN&gt;&amp;amp;Dimension_tbl. contain?&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Since your data is from a Transpose, I assume that the variables (columns) you want to drop share a common prefix, correct?&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:04:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846150#M334512</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-24T14:04:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846151#M334513</link>
      <description>&lt;P&gt;No, but you can use a variable range for this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;drop date1-date&lt;SPAN&gt;&amp;amp;Dimension_tbl.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0wphcpsfgx6o7n1sjtqzizp1n39.htm#:~:text=the%20RENAME%3D%20option.-,Numbered%20Range%20Lists,-Definition" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0wphcpsfgx6o7n1sjtqzizp1n39.htm#:~:text=the%20RENAME%3D%20option.-,Numbered%20Range%20Lists,-Definition&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846151#M334513</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-11-24T14:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846155#M334516</link>
      <description>Thanks for your reply.&lt;BR /&gt;&lt;BR /&gt;&amp;amp;Dimension_tbl. contains the number of columns created during the transpose, it's the number of date variables&lt;BR /&gt;&lt;BR /&gt;And yes, the variables that I want to drop share a common prefix, which is "date". The suffix is between 1 and &amp;amp;Dimension_tbl.</description>
      <pubDate>Thu, 24 Nov 2022 14:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846155#M334516</guid>
      <dc:creator>Mathis91</dc:creator>
      <dc:date>2022-11-24T14:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846157#M334517</link>
      <description>Thanks but it didn't work.&lt;BR /&gt;In the documentation I didn't see an example with a macrovariable, I don't know if it's me who doesn't understand how to use it</description>
      <pubDate>Thu, 24 Nov 2022 14:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846157#M334517</guid>
      <dc:creator>Mathis91</dc:creator>
      <dc:date>2022-11-24T14:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846159#M334518</link>
      <description>&lt;P&gt;Ok. Then you can use the logic by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;or simply do&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop date:;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which will drop all variables prefixed with 'date' .&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:18:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846159#M334518</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-24T14:18:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846160#M334519</link>
      <description>Thanks a lot, I didn't know about this feature !</description>
      <pubDate>Thu, 24 Nov 2022 14:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846160#M334519</guid>
      <dc:creator>Mathis91</dc:creator>
      <dc:date>2022-11-24T14:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variables in a do</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846165#M334524</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;No, but you can use a variable range for this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;drop date1-date&lt;SPAN&gt;&amp;amp;Dimension_tbl.;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0wphcpsfgx6o7n1sjtqzizp1n39.htm#:~:text=the%20RENAME%3D%20option.-,Numbered%20Range%20Lists,-Definition" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lrcon/p0wphcpsfgx6o7n1sjtqzizp1n39.htm#:~:text=the%20RENAME%3D%20option.-,Numbered%20Range%20Lists,-Definition&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is the better answer than use date: variable list.&amp;nbsp; If you drop using the date prefix it might drop other variables that were not intended.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 14:44:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variables-in-a-do/m-p/846165#M334524</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-24T14:44:53Z</dc:date>
    </item>
  </channel>
</rss>

