<?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 DROP Statement: Only drop elements that are in an array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DROP-Statement-Only-drop-elements-that-are-in-an-array/m-p/434583#M107853</link>
    <description>&lt;P&gt;New SAS user here. I'm attempting to convert character values to numeric values using arrays. After the conversion, I would like to DROP all the fields that comprise my initial array (character values). Is there a way to drop only the variables that appear in my character values array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
	infile datalines delimiter=','; 
	input col1 $ col2 $ col3 $ oddball $;
	format col1--oddball $char100.;
	datalines;
1,2,0,a
2,3,0,b
3,4,0,c 
		;
run;

data test2;
	set test;

	format newCol1-newCol3 best.;

    array myarray Col1-Col3;
    array myNewarray newCol1-newCol3;
    do i=1 to dim(myarray);
           myNewarray[i]= input(myarray[i],best.);
    end;
    drop myarry[*];
run;&lt;/PRE&gt;&lt;P&gt;I'm receiving the error at the DROP statement.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Feb 2018 16:18:06 GMT</pubDate>
    <dc:creator>jmobball34</dc:creator>
    <dc:date>2018-02-06T16:18:06Z</dc:date>
    <item>
      <title>DROP Statement: Only drop elements that are in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DROP-Statement-Only-drop-elements-that-are-in-an-array/m-p/434583#M107853</link>
      <description>&lt;P&gt;New SAS user here. I'm attempting to convert character values to numeric values using arrays. After the conversion, I would like to DROP all the fields that comprise my initial array (character values). Is there a way to drop only the variables that appear in my character values array?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data test;
	infile datalines delimiter=','; 
	input col1 $ col2 $ col3 $ oddball $;
	format col1--oddball $char100.;
	datalines;
1,2,0,a
2,3,0,b
3,4,0,c 
		;
run;

data test2;
	set test;

	format newCol1-newCol3 best.;

    array myarray Col1-Col3;
    array myNewarray newCol1-newCol3;
    do i=1 to dim(myarray);
           myNewarray[i]= input(myarray[i],best.);
    end;
    drop myarry[*];
run;&lt;/PRE&gt;&lt;P&gt;I'm receiving the error at the DROP statement.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2018 16:18:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DROP-Statement-Only-drop-elements-that-are-in-an-array/m-p/434583#M107853</guid>
      <dc:creator>jmobball34</dc:creator>
      <dc:date>2018-02-06T16:18:06Z</dc:date>
    </item>
    <item>
      <title>Re: DROP Statement: Only drop elements that are in an array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DROP-Statement-Only-drop-elements-that-are-in-an-array/m-p/434584#M107854</link>
      <description>&lt;P&gt;I don’t think you can reference an array in the DROP statement, but you can list your variables the way you did in the array statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Drop col1-col3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Feb 2018 16:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DROP-Statement-Only-drop-elements-that-are-in-an-array/m-p/434584#M107854</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-06T16:19:13Z</dc:date>
    </item>
  </channel>
</rss>

