<?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: Using a Macro Array as a Regular Array inside a data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83705#M18066</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's in the %array code? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens if you try and resolve it before the code&lt;/P&gt;&lt;P&gt;%put &amp;amp;exemptarr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And what does the log say if you run it with options mprint and mlogic turned on?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Jun 2012 20:26:20 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2012-06-14T20:26:20Z</dc:date>
    <item>
      <title>Using a Macro Array as a Regular Array inside a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83704#M18065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm sure this is an easy solution, but I can't seem to find it online.&amp;nbsp; I have created a macro array with a list of 100 or so words that I want excluded from various comments lines. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%array(&amp;amp;exemptarr, data=exemptvalues, var=exemptv); &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sasdata.commcheck; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set commentsearch; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nomore=0; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format cleanname $100.; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (nomore); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if scan(namelist, i, ' ') = '&amp;nbsp; ' then nomore=1; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; terms = scan(namelist,i,' '); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &lt;EM&gt;terms not in &amp;amp;exemptarr&lt;/EM&gt; then cleanname=catx (' ', cleanname, terms); &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end; &lt;/P&gt;&lt;P&gt;end; &lt;/P&gt;&lt;P&gt;run; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to call the "exemptarr" array to compare it to the terms list but when I do without the ampersand it gives me the following: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: The right-hand operand must be an array name or a constant value list. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And when I include the ampersand(like in the example above) it gives me the following error: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference EXEMPTARR not resolved. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be much appreciated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 19:54:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83704#M18065</guid>
      <dc:creator>A_Train</dc:creator>
      <dc:date>2012-06-14T19:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Macro Array as a Regular Array inside a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83705#M18066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What's in the %array code? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What happens if you try and resolve it before the code&lt;/P&gt;&lt;P&gt;%put &amp;amp;exemptarr;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And what does the log say if you run it with options mprint and mlogic turned on?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Jun 2012 20:26:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83705#M18066</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2012-06-14T20:26:20Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Macro Array as a Regular Array inside a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83706#M18067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;exemptarr,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Should be "a" "b" "c" "d" .......&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;and &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;if &lt;EM&gt;terms not in &amp;amp;exemptarr&amp;nbsp;&amp;nbsp; -----&amp;gt;&amp;nbsp; &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;if &lt;EM&gt;terms not in ( &amp;amp;exemptarr )&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 02:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83706#M18067</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-06-15T02:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using a Macro Array as a Regular Array inside a data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83707#M18068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;A-Train wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I'm sure this is an easy solution, but I can't seem to find it online.&amp;nbsp; I have created a macro array with a list of 100 or so words that I want excluded from various comments lines.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%array(&amp;amp;exemptarr, data=exemptvalues, var=exemptv); &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;data sasdata.commcheck;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set commentsearch;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nomore=0;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; format cleanname $100.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do until (nomore);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if scan(namelist, i, ' ') = '&amp;nbsp; ' then nomore=1;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; terms = scan(namelist,i,' ');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if &lt;EM&gt;terms not in &amp;amp;exemptarr&lt;/EM&gt;then cleanname=catx (' ', cleanname, terms);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I would like to call the "exemptarr" array to compare it to the terms list but when I do without the ampersand it gives me the following:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;ERROR: The right-hand operand must be an array name or a constant value list.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;And when I include the ampersand(like in the example above) it gives me the following error:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;WARNING: Apparent symbolic reference EXEMPTARR not resolved.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Any help would be much appreciated.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;I would forget about taking your perfectly good SAS data set of exemptvalues and writing them to an enumerated list of macro variables.&amp;nbsp; The data pretty much become useless at that point. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I understand correctly you have a data set of text data (from various comment lines) in the variable "NAMELIST" and you want to remove any word in "NAMELIST" that is also in data exemptvalues.&amp;nbsp; There are a number of way to do this include the way you are using.&amp;nbsp; To create and ARRAY of exempvalues you could use PROC TRANSPOSE to transpose the data into a one observation data set and use that to create and array in a data step. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;transpose&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;=sashelp.class &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;=exvalues &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;prefix&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;=exmp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;var&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; _n_ eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 10pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;then&lt;/SPAN&gt; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; exvalues;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; background: white; color: blue; font-family: 'Courier New';"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; _ex&lt;LI&gt; exmp:;&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;the rest&amp;gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How you remove the words depends on what you call a word and how they are delimited.&amp;nbsp; It could be as simple as TRANSTRN but you should supply some sample data to make it easier to understand.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Jun 2012 13:25:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-Macro-Array-as-a-Regular-Array-inside-a-data-step/m-p/83707#M18068</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2012-06-15T13:25:59Z</dc:date>
    </item>
  </channel>
</rss>

