<?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 refer all elements in array in DROP statement in data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225707#M40539</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if someone can help me with a question working with array in data step. I was trying to drop all elements in an array after the reshape. Here is what i've tried and it gave error message that i can't refer the array this way in DROP statement. Is there a way to do it? Thanks in advance. - Xin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tmp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;set tmp2;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;array wide{*} _numeric_;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;lt;other statement&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;drop wide{*};&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 15 Sep 2015 20:33:07 GMT</pubDate>
    <dc:creator>Xin</dc:creator>
    <dc:date>2015-09-15T20:33:07Z</dc:date>
    <item>
      <title>refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225707#M40539</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was wondering if someone can help me with a question working with array in data step. I was trying to drop all elements in an array after the reshape. Here is what i've tried and it gave error message that i can't refer the array this way in DROP statement. Is there a way to do it? Thanks in advance. - Xin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data tmp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;set tmp2;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;array wide{*} _numeric_;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;lt;other statement&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;drop wide{*};&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 20:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225707#M40539</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2015-09-15T20:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225715#M40541</link>
      <description>&lt;P&gt;If the purpose of this was to go from wide to narrow it likely is easier to KEEP the new variables. If there are lots of character variables to keep then use the _character_ variable list in the keep statement.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 21:18:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225715#M40541</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-09-15T21:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225717#M40542</link>
      <description>&lt;P&gt;No, you can't do that as you have already figured out. The reason being non-executable statements such as 'Drop/Keep' works during the compiling stage, while Array&amp;nbsp;statement works on execution stage.&amp;nbsp;However, for&amp;nbsp;the example you&amp;nbsp;presented, you can do the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;drop of _numeric_;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 21:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225717#M40542</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2015-09-15T21:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225719#M40543</link>
      <description>drop _numeric_;&lt;BR /&gt;but that will also drop any new numeric variable created in the datastep.</description>
      <pubDate>Tue, 15 Sep 2015 21:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225719#M40543</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2015-09-15T21:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225721#M40544</link>
      <description>&lt;P&gt;You don't need OF unless it is a variable name. &amp;nbsp;OF is the special function syntax.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 21:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225721#M40544</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-09-15T21:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225722#M40545</link>
      <description>&lt;P&gt;Yes, as you've point out, KEEP statement can be troublesome when there are lot of char varibles to keep. KEEP _character_ works well. Thanks a lot.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 21:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225722#M40545</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2015-09-15T21:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225723#M40546</link>
      <description>&lt;P&gt;The drop _numeric_ will drop the new variables i've created and won't work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 21:36:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225723#M40546</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2015-09-15T21:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225734#M40554</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Drop _numeric_ doesn't seem to be working. Here is a test:&lt;BR /&gt;&lt;BR /&gt;data tmp; 
   set sashelp.class; 
   array wide[*] _numeric_; 
   do i = 1 to dim(wide);
      put wide[i] =;
   end;
   drop  _numeric_;
   put wide[*] =;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Sep 2015 22:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225734#M40554</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2015-09-15T22:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225735#M40555</link>
      <description>&lt;P&gt;It worked on my computer. The three numberical variables are dropped in tmp as indicated by DROP statement.&amp;nbsp;The last PUT statement will generate the three variables in log.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 22:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225735#M40555</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2015-09-15T22:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225739#M40557</link>
      <description>&lt;P&gt;Yes TMP is OK.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Sep 2015 23:12:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/225739#M40557</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2015-09-15T23:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/226157#M40675</link>
      <description>&lt;P&gt;This statement works IF you place it properly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;drop _numeric_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should appear immediately after the ARRAY statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In a DATA step, _numeric_ changes meaning as the DATA step creates more numeric variables.&amp;nbsp; So place the DROP statement after ARRAY, but before creating additional variables.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Sep 2015 22:45:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/226157#M40675</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2015-09-17T22:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: refer all elements in array in DROP statement in data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/226672#M40824</link>
      <description>&lt;P&gt;Thanks! This is the solution!&lt;/P&gt;</description>
      <pubDate>Mon, 21 Sep 2015 23:10:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/refer-all-elements-in-array-in-DROP-statement-in-data-step/m-p/226672#M40824</guid>
      <dc:creator>Xin</dc:creator>
      <dc:date>2015-09-21T23:10:36Z</dc:date>
    </item>
  </channel>
</rss>

