<?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: Referencing Global Arrays in Data Step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311535#M67362</link>
    <description>&lt;P&gt;It is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%let topMetros = array &lt;FONT color="#FF0000"&gt;topMetros&lt;/FONT&gt;[10] $5 metro1-metro10...&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2016 21:47:22 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-11-14T21:47:22Z</dc:date>
    <item>
      <title>Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311489#M67352</link>
      <description>&lt;P&gt;All, I am trying to reference a global array so that I can output a series of files based on the matching of values in a variable. Below is the code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let topMetros = array[10] $5. metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460'); 

%macro count(toomany); 

%do i = 1 %to &amp;amp;toomany; 

data geog.uscis_ois_lpr_s5_mtr&amp;amp;i.; 
f CBSA_CODE = topMetros[&amp;amp;i]. then output geog.uscis_ois_lpr_s5_mtr&amp;amp;i.; 

%end; 
%mend count; 

%count(10); 

run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I do I get an error message of the following:&lt;/P&gt;
&lt;P&gt;"180: LINE and COLUMN cannot be determined. NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred. ERROR 180-322: Statement is not valid or it is used out of proper order."&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:04:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311489#M67352</guid>
      <dc:creator>RedMcCallen</dc:creator>
      <dc:date>2016-11-14T21:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311510#M67353</link>
      <description>&lt;P&gt;Assuming input dataset is called HAVE, I think you mean:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let topMetros = array topMetros[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460'); 

%macro count(toomany); 
%do i = 1 %to &amp;amp;toomany; 
	data geog.uscis_ois_lpr_s5_mtr&amp;amp;i.; 
        set HAVE;
	%topMetros;
	if CBSA_CODE = topMetros[&amp;amp;i.] then output; 
        drop metro:;
	run;
	%end; 
%mend count; 

%count(10);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Nov 2016 20:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311510#M67353</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-14T20:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311526#M67354</link>
      <description>I can't get the formatting to come out right. All I get is this tiny box to put anything into regardless of browser that I use.&lt;BR /&gt;&lt;BR /&gt;However, the above code does not work, keep saying that I have an undeclared array referenced: topMetros.</description>
      <pubDate>Mon, 14 Nov 2016 21:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311526#M67354</guid>
      <dc:creator>RedMcCallen</dc:creator>
      <dc:date>2016-11-14T21:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311530#M67358</link>
      <description>&lt;P&gt;OK, a tested version now:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do CBSA_CODE = '35620', '31090', '33100', '16980', '41860', '47900', '26420', '19100', '41940', '14460';
output;
end;
run;


options mprint;
%let topMetros = array topMetros[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460'); 

%macro count(toomany); 
%do i = 1 %to &amp;amp;toomany; 
	data uscis_ois_lpr_s5_mtr&amp;amp;i.; 
        set HAVE;
	&amp;amp;topMetros;
	if CBSA_CODE = topMetros[&amp;amp;i.] then output; 
        drop metro:;
	run;
	%end; 
%mend count; 

%count(10);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Replaced %topMetros (macro call) with &amp;amp;topMetros (macro variable reference).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:26:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311530#M67358</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-14T21:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311531#M67359</link>
      <description>Nope, now get the following error message.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5. metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;___&lt;BR /&gt;22&lt;BR /&gt;200&lt;BR /&gt;ERROR: Undeclared array referenced: array.&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5. metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_______&lt;BR /&gt;68&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: +, =.&lt;BR /&gt;&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;ERROR 68-185: The function METRO10 is unknown, or cannot be accessed.&lt;BR /&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311531#M67359</guid>
      <dc:creator>RedMcCallen</dc:creator>
      <dc:date>2016-11-14T21:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311532#M67360</link>
      <description>&lt;P&gt;The code as posted is tested and it works. What did you try?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311532#M67360</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-14T21:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311533#M67361</link>
      <description>22 GOPTIONS ACCESSIBLE;&lt;BR /&gt;23 %let topMetros = array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940'&lt;BR /&gt;23 ! '14460');&lt;BR /&gt;24&lt;BR /&gt;25 %macro count(toomany);&lt;BR /&gt;26 %do i = 1 %to &amp;amp;toomany;&lt;BR /&gt;27 data geog.uscis_ois_lpr_s5_mtr&amp;amp;i. (drop = metro:);&lt;BR /&gt;28 set geog.uscis_ois_lpr_s5_metros;&lt;BR /&gt;29 &amp;amp;topMetros;&lt;BR /&gt;30&lt;BR /&gt;31 if CBSA_CODE = topMetros[&amp;amp;i.] then&lt;BR /&gt;32 output geog.uscis_ois_lpr_s5_mtr&amp;amp;i.;&lt;BR /&gt;33&lt;BR /&gt;34 run;&lt;BR /&gt;35&lt;BR /&gt;36 %end;&lt;BR /&gt;37 %mend count;&lt;BR /&gt;38 %count(10);&lt;BR /&gt;ERROR: Undeclared array referenced: array.&lt;BR /&gt;NOTE 138-205: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_&lt;BR /&gt;22&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: +, =.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_&lt;BR /&gt;200&lt;BR /&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_______&lt;BR /&gt;68&lt;BR /&gt;ERROR 68-185: The function METRO10 is unknown, or cannot be accessed.&lt;BR /&gt;2 The SAS System 15:19 Monday, November 14, 2016&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_______&lt;BR /&gt;388&lt;BR /&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;BR /&gt;&lt;BR /&gt;NOTE: Line generated by the macro variable "TOPMETROS".&lt;BR /&gt;38 array[10] $5 metro1-metro10 ('35620' '31090' '33100' '16980' '41860' '47900' '26420' '19100' '41940' '14460')&lt;BR /&gt;_______&lt;BR /&gt;76&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;ERROR: Undeclared array referenced: topMetros.&lt;BR /&gt;ERROR: Variable topMetros has not been declared as an array.&lt;BR /&gt;&lt;BR /&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;3537:113&lt;BR /&gt;WARNING: The variable 'metro:'n in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set GEOG.USCIS_OIS_LPR_S5_MTR1 may be incomplete. When this step was stopped there were 0 observations and 36&lt;BR /&gt;variables.&lt;BR /&gt;WARNING: Data set GEOG.USCIS_OIS_LPR_S5_MTR1 was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds</description>
      <pubDate>Mon, 14 Nov 2016 21:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311533#M67361</guid>
      <dc:creator>RedMcCallen</dc:creator>
      <dc:date>2016-11-14T21:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311535#M67362</link>
      <description>&lt;P&gt;It is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;%let topMetros = array &lt;FONT color="#FF0000"&gt;topMetros&lt;/FONT&gt;[10] $5 metro1-metro10...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:47:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311535#M67362</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-14T21:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Referencing Global Arrays in Data Step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311544#M67366</link>
      <description>Can't believe I missed that! I was focusing on the main bloc. But still, I am an editor and should have caught that.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Mon, 14 Nov 2016 22:08:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Referencing-Global-Arrays-in-Data-Step/m-p/311544#M67366</guid>
      <dc:creator>RedMcCallen</dc:creator>
      <dc:date>2016-11-14T22:08:42Z</dc:date>
    </item>
  </channel>
</rss>

