<?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: Create an array from a macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820272#M323742</link>
    <description>&lt;P&gt;Where is the data coming from?&amp;nbsp; What structure does it have there?&amp;nbsp; What structure do you want to create?&lt;/P&gt;
&lt;P&gt;Why do you think this has anything to do with ARRAYs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS dataset is already a MATRIX.&amp;nbsp; The observations are the ROWS.&amp;nbsp; The variables are the COLUMNS.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 15:41:44 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-06-24T15:41:44Z</dc:date>
    <item>
      <title>Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467795#M119432</link>
      <description>&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I've been struggling with a minor task. I want to extract numbers from a single column on an Excel and use it in a Risk Dimensions process, and I would like to have an array in which every item is an observation (one of the numbers that I extracted from the Excel file).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sfsfsfs.png" style="width: 325px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21046iBDA6AD6EF4743807/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sfsfsfs.png" alt="sfsfsfs.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I would like to end up with something like: tasas1 = 95.354 tasas 2= 95.272 and so on (not exactly, as I only want the observations&amp;nbsp;corresponding to the 22th of January of July, but that's the idea).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I got the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path = "/data/user/XX";
libname desa "/data/user/XX";


data AA;
set desa.cer;

if ((month(fecha) = 07 or month(fecha)= 01) and  day(fecha) = 22) then
output;
run;

proc sql noprint;
select cer into :emp_list separated by ' ' from AA;
quit;

data BB;
array tasas [6];
do i = 1 to 6;
tasas[i] = &amp;nbsp;scan(&amp;amp;emp_list, i, ' ');
i = i+1;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know the&amp;nbsp;macro variable emp_list has all the values I want:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ss.png" style="width: 442px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21049i13676CB18789B8E7/image-size/large?v=v2&amp;amp;px=999" role="button" title="ss.png" alt="ss.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue comes when I try to assign each item in the array the value extracted from emp_list. I get:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR 388-185: Expecting an arithmetic operator.&lt;/P&gt;&lt;P&gt;ERROR 200-322: The symbol is not recognized and will be ignored.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And when I use other characters and separators (such as&amp;nbsp;|) I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sccs.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21047i8145B5EFF939691B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sccs.png" alt="sccs.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there any way to get it right?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 18:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467795#M119432</guid>
      <dc:creator>klasko</dc:creator>
      <dc:date>2018-06-05T18:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467839#M119439</link>
      <description>&lt;P&gt;Is there any reason you need to use the macro variable?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems to me this would be an excellent use of a transpose statement.&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;After the AA data step, use&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc transpose data=AA out=BB prefix=tasas;&lt;/P&gt;&lt;P&gt;var CER;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This has the added benefit of producing as many or as few columns as there are records in AA.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467839#M119439</guid>
      <dc:creator>Dougall</dc:creator>
      <dc:date>2018-06-05T20:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467852#M119444</link>
      <description>&lt;P&gt;Loading a list of values into an array is easier than you would think.&amp;nbsp; You have this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; BB&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;array&lt;/SPAN&gt; tasas &lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;6&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
do i &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; to &lt;SPAN class="token number"&gt;6&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
tasas&lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;i&lt;SPAN class="token punctuation"&gt;]&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;  &lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;emp_list&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; i&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;' '&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
i &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; i&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; BB&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;array&lt;/SPAN&gt; tasas &lt;SPAN class="token punctuation"&gt;[&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;6&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;] (&amp;amp;emp_list)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467852#M119444</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-05T20:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467953#M119481</link>
      <description>&lt;P&gt;Thanks! It worked, but I came into another problem. It creates the variables tasas1 to tasas6, but when I try to use them in a DO loop I get ERROR: Undeclared array referenced: tasas.&lt;BR /&gt;ERROR: Variable tasas has not been declared as an array.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm kind of lost. Didn't I create an array named tasas?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 04:01:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/467953#M119481</guid>
      <dc:creator>klasko</dc:creator>
      <dc:date>2018-06-06T04:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/468133#M119543</link>
      <description>&lt;P&gt;Array definitions are temporary.&amp;nbsp; Arrays exist only in the same DATA step that contains the ARRAY statement.&amp;nbsp; You might need to repeat the ARRAY statement in a later DATA step.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jun 2018 17:10:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/468133#M119543</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-06T17:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/470076#M120312</link>
      <description>&lt;P&gt;What do I have to do if I want to use those values in a DO Loop inside a proc compile?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't use macros.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/470076#M120312</guid>
      <dc:creator>klasko</dc:creator>
      <dc:date>2018-06-13T20:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/470115#M120329</link>
      <description>&lt;P&gt;Sorry, I don't think I will be able to help with PROC COMPILE.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jun 2018 20:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/470115#M120329</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-06-13T20:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819550#M323509</link>
      <description>&lt;P&gt;does it works on multidimentional arrays too?&amp;nbsp;&lt;/P&gt;&lt;P&gt;let's suppose i've got&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;array two_dim_array[&amp;amp;N_rows,&amp;amp;N_cols] &amp;amp;col1. &amp;amp;col2. .... &amp;amp;colN.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;will it works or there are other metod to create them?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 08:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819550#M323509</guid>
      <dc:creator>Morsecode90</dc:creator>
      <dc:date>2022-06-22T08:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819793#M323580</link>
      <description>&lt;P&gt;It works for multidimensional arrays, but you have to be careful to supply the correct number of elements.&amp;nbsp; With those dimensions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;{&amp;amp;n_rows, &amp;amp;n_cols}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the proper number of elements is not N, but &amp;amp;n_rows * &amp;amp;n_cols.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 19:11:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819793#M323580</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2022-06-22T19:11:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819797#M323581</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/213817"&gt;@klasko&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What do I have to do if I want to use those values in a DO Loop inside a proc compile?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can't use macros.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is PROC COMPILE?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 19:19:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819797#M323581</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-22T19:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819804#M323583</link>
      <description>&lt;P&gt;Do not convert NUMBERS (values of the CER variable) into STRINGS (value in the macro variable(s)) just to later try to convert them back into NUMBERS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert multiple observations into multiple variables you can use PROC TRANSPOSE.&amp;nbsp; For example if you sorted the data by ID and DATE you might want to generate one observation per ID instead of one observation per ID and DATE by using a PROC TRANSPOSE like this.&amp;nbsp; The PREFIX= option says to name the generated variables as TASAS1, TASAS2 , etc.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=desa.cer  out=want(drop=_name_) prefix=TASAS ;
  by id ;
  var cer ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But the PHOTOGRAPH you posted of your data does not look like it is properly organized for transposing.&amp;nbsp; Why the the observations all of different values of ID and DATE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also it looks like you are trying to subset data to just specific days in the year.&amp;nbsp; Which year? Or are there multiple years?&amp;nbsp; &amp;nbsp;Does each ID have all of the years?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is simplified way to select those two days of the year (independent of which year) by using formats to convert the date values into strings you can test.&amp;nbsp; The PUT() function with the DDMMYY10 format converts dates into strings that look alot like the values in your posted photograph, only they will always use two digits for day and month.&amp;nbsp; The colon modifier on the equality test will match the string just to the length of the shorter of the two.&amp;nbsp; So just the DD/MM part of the result of the PUT() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where put(fecha,DDMMYY10.) in: ('22/01' '22/07') ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Perhaps you don't need to define any ARRAYs at all for what you are trying to do.&amp;nbsp; If you create a series of variable that all have the same base name and numeric suffix with sequential values, like TASAS1, TASAS2 , ... then you can just reference them use a variable list where you need them in your code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember that an ARRAY in SAS code is just a way to make it easy to reference many different variables by using an index into a list of the variable names.&amp;nbsp; Those references are only valid in the data step where the ARRAY is defined.&amp;nbsp; It is just a tool to make it so you can repeat similar statements without having to type &lt;A href="https://stackoverflow.com/questions/58251372/what-is-the-difference-between-sas-array-and-sas-if-then/58253218#58253218" target="_self"&gt;"wallpaper" code.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 19:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/819804#M323583</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-22T19:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820270#M323741</link>
      <description>&lt;P&gt;thanks a lot,&amp;nbsp;&lt;/P&gt;&lt;P&gt;just another question, do you have any suggestion on how to load a table into those arrays?&lt;/P&gt;&lt;P&gt;my table has 6 rows and 77 columns&lt;/P&gt;&lt;P&gt;there are 2 problems:&amp;nbsp;&lt;/P&gt;&lt;P&gt;-even if the columns are all char they have different length, someone is&amp;nbsp; more than 8char long;&lt;/P&gt;&lt;P&gt;-the macrovariable compile the array with 6*77=462 but they appear to be all cols instead of rows*cols.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; my code is looking like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql;
select *
into : DISNEY_CHAR separated by '" "'
from char_by_season;
quit;

data DOGS_IN_DISNEY;
array dogs[&amp;amp;n_rows.,&amp;amp;n_cols.] "&amp;amp;DISNEY_CHAR.";
/*where n_rows=6 and n_cols=77 */
do r=1 to 6;
	do c=1 to 77;
		if dogs[r,c] in("Goofy","Pluto") then output;
	end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 15:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820270#M323741</guid>
      <dc:creator>Morsecode90</dc:creator>
      <dc:date>2022-06-24T15:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820272#M323742</link>
      <description>&lt;P&gt;Where is the data coming from?&amp;nbsp; What structure does it have there?&amp;nbsp; What structure do you want to create?&lt;/P&gt;
&lt;P&gt;Why do you think this has anything to do with ARRAYs?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A SAS dataset is already a MATRIX.&amp;nbsp; The observations are the ROWS.&amp;nbsp; The variables are the COLUMNS.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 15:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820272#M323742</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-24T15:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820274#M323744</link>
      <description>&lt;P&gt;hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to load a table wich has (at the moment) 77 variables and 6 observations into a bidimentional array because i have to filter every single combination of the two dimensions in the table with a specific rule mapped into another table.&lt;/P&gt;&lt;P&gt;In order to do so, i have to read both the field and the rule and i have to do it dynamically because both tables may vary in both dimentions (nrows,ncols). the only way that i've been able to think to solve it is by using arrays.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the input table has all char attributes but their lenght range from 1 to 200.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the rules table has 5 variables,&amp;nbsp; 1 is a key while the combination of the remainings gives out the rules.&lt;/P&gt;&lt;P&gt;variables of the data table are the keys in the rules table.&lt;/P&gt;&lt;P&gt;i have almost no experience in sas so any help would be appreciated.&lt;/P&gt;&lt;P&gt;thanks for the help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820274#M323744</guid>
      <dc:creator>Morsecode90</dc:creator>
      <dc:date>2022-06-24T16:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820279#M323748</link>
      <description>&lt;P&gt;What I normally do in that case is use the RULE metadata to generate CODE.&amp;nbsp; Then run the CODE on the actual DATA.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The most complex one I have seen is for LAB normal range checks.&amp;nbsp; To the RULE metadata has the labcode and the logic for calculating status.&amp;nbsp;&amp;nbsp;So the code to generate the code would essentially read the RULE metadata and write the code lines to a file.&amp;nbsp; So you might generate something like this into a temporary file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  select (labcode);
     when ('ABCD') do;
        high = value &amp;gt; 2.0*ULN ;
        low = .z &amp;lt; value &amp;lt; 2.0*LLN;
       end;
    when ('XYZ') do;
        high = value &amp;gt; 125 ;
        low = .z &amp;lt; value &amp;lt; 50 ;
        end;
  end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use code like this to run it against the actual lab data.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
%include code ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:45:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820279#M323748</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-06-24T16:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create an array from a macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820660#M323952</link>
      <description>&lt;P&gt;thanks again, that's the way i'm using the metadata's sheets when i need to create a table, but in this case i'm using them with a different purpose.&amp;nbsp;&lt;/P&gt;&lt;P&gt;the data table is the result of a merge between a dinamic number of tables (it can be 2 or 1000).&lt;/P&gt;&lt;P&gt;what i want to do is to check if ther's any duplicates by key, if duplicates are presents then in the metadata i have described the weight by attributes coming from each source table. the one with heavier weight overwrite the others wich need to be saved into a dump table for future tracking, the issue here is that the weight are listed by attribute and not by source table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jun 2022 09:57:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-an-array-from-a-macro-variable/m-p/820660#M323952</guid>
      <dc:creator>Morsecode90</dc:creator>
      <dc:date>2022-06-28T09:57:58Z</dc:date>
    </item>
  </channel>
</rss>

