<?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: writing formula with arrays in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536240#M6607</link>
    <description>&lt;P&gt;Hi Gocersah,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arrays can be used but not directly. I give you an array solution as much as I understand your problem.&lt;/P&gt;
&lt;P&gt;The steps are:&lt;/P&gt;
&lt;P&gt;[1] Hold the values of ex1_1 ... ex1_4 in an array.&lt;/P&gt;
&lt;P&gt;[2] Similarly, hold ex2_.., ex3_ in separate arrays.&lt;/P&gt;
&lt;P&gt;[3] Hold sumex1, sumex2 and sumex3 in another array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used some fictional values for the cells of the arrays and computed p_m1, p_m2 and p_m3. I place the intermediate values computed from the arrays in the LOG.&lt;/P&gt;
&lt;PRE&gt;data _null_;
array ex1[4] _temporary_ (10,20,30,40);
array ex2[4] _temporary_ (20,30,40,50);
array ex3[4] _temporary_ (30,40,50,60);
array sumex[3] _temporary_  (5,10,10);

do i = 1 to dim(ex1);
   ex1[i] = ex1[i] / sumex[1];
   ex2[i] = ex2[i] / sumex[2];
   ex3[i] = ex3[i] / sumex[3];
   put ex1[i] = ex2[i] = ex3[i] =;
end;
p_m1 = 0; p_m2 = 0; p_m3 = 0;
do i = 1 to dim(ex1);
p_m1 = p_m1 + ex1[i] * ex3[i];
p_m2 = p_m2 + ex1[i] * ex2[i];
p_m3 = p_m3 + ex2[i] * ex3[i];
end;
put p_m1 = p_m2 = p_m3= ;  
run;

 On the Log:

 ex1[1]=2 ex2[1]=2 ex3[1]=3
 ex1[2]=4 ex2[2]=3 ex3[2]=4
 ex1[3]=6 ex2[3]=4 ex3[3]=5
 ex1[4]=8 ex2[4]=5 ex3[4]=6
 p_m1=100 p_m2=80 p_m3=68
&lt;/PRE&gt;
&lt;P&gt;The original values in the arrays ex1[ ], ex2[ ], ex3[ ] are modified in place by the appropriate division of sumx:&lt;/P&gt;
&lt;P&gt;Then the&amp;nbsp; product sums are simply the product of two parallel columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;DATAsp&lt;/P&gt;</description>
    <pubDate>Sun, 17 Feb 2019 14:43:26 GMT</pubDate>
    <dc:creator>KachiM</dc:creator>
    <dc:date>2019-02-17T14:43:26Z</dc:date>
    <item>
      <title>writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536226#M6603</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Although I understand the pattern/idea of formula I don't know how to write it with arrays. For example for p_m1 the equation is,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p_m1=(ex1_1/sumex1)*(ex3_1/sumex3) +&amp;nbsp;(ex1_2/sumex1)*(ex3_2/sumex3) +&amp;nbsp;(ex1_3/sumex1)*(ex3_3/sumex3) +&amp;nbsp;(ex1_4/sumex1)*(ex3_4/sumex3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For p_m2 it is,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p_m2=(ex1_1/sumex1)*(ex2_1/sumex2) +&amp;nbsp;(ex1_2/sumex1)*(ex2_2/sumex2) +&amp;nbsp;(ex1_3/sumex1)*(ex2_3/sumex2) +&amp;nbsp;(ex1_4/sumex1)*(ex2_4/sumex2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and lastly for p_m3 it is,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p_m3= (ex2_1/sumex2)*(ex3_1/sumex3) +&amp;nbsp;(ex2_2/sumex2)*(ex3_2/sumex3) +&amp;nbsp;(ex2_3/sumex2)*(ex3_3/sumex3) +&amp;nbsp;(ex2_4/sumex2)*(ex3_4/sumex3)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll appreciate you if you help me to write these codes with arrays/loops whatever I need.&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data all_pars1;&lt;BR /&gt;set all_pars (obs=20);;&lt;BR /&gt;array t {3} theta1-theta3 ;&lt;BR /&gt;array ex {3,4} &amp;amp;vlist; &lt;BR /&gt;array s {4};&lt;BR /&gt;array inc {4};&lt;BR /&gt;array sumex{3} 8.;&lt;BR /&gt;array p_m{4} ;&lt;BR /&gt;do i=1 to 3;&lt;BR /&gt;do j=1 to 4;&lt;BR /&gt;ex(i,j)=exp(t(i)*s(j)+inc(j));&lt;BR /&gt;sumex{i}=sum(sumex{i},ex{i,j});&lt;BR /&gt;p_m{j}=..........................&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 05:51:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536226#M6603</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-02-17T05:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536230#M6605</link>
      <description>&lt;P&gt;One index value goes 1-1-2, the other 3-2-3. The code needed to derive those values from the 1-2-3 sequence of a possible do loop might cause enough obfuscation to offset the gain by using only one formula line with arrays.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 06:35:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536230#M6605</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-17T06:35:11Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536235#M6606</link>
      <description>Because of the changing patterns to the variable names, arrays would be a poor tool for the job.  If it is valuable to you to build job security by complicating the code, you could use 3 calls to a macro.  For example, a macro call to compute p_m1 would look something like this:&lt;BR /&gt;&lt;BR /&gt;%compute (1,1_1,1,3_1,3,1_2,1,3_2,3,1_3,1,3_3,3,1_4,1,3_4,3)&lt;BR /&gt;&lt;BR /&gt;And there are questions to clear up first about the variable names, before even trying to write such a macro.  Does this sound like it would be worthwhile to you?</description>
      <pubDate>Sun, 17 Feb 2019 07:28:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536235#M6606</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-02-17T07:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536240#M6607</link>
      <description>&lt;P&gt;Hi Gocersah,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Arrays can be used but not directly. I give you an array solution as much as I understand your problem.&lt;/P&gt;
&lt;P&gt;The steps are:&lt;/P&gt;
&lt;P&gt;[1] Hold the values of ex1_1 ... ex1_4 in an array.&lt;/P&gt;
&lt;P&gt;[2] Similarly, hold ex2_.., ex3_ in separate arrays.&lt;/P&gt;
&lt;P&gt;[3] Hold sumex1, sumex2 and sumex3 in another array.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used some fictional values for the cells of the arrays and computed p_m1, p_m2 and p_m3. I place the intermediate values computed from the arrays in the LOG.&lt;/P&gt;
&lt;PRE&gt;data _null_;
array ex1[4] _temporary_ (10,20,30,40);
array ex2[4] _temporary_ (20,30,40,50);
array ex3[4] _temporary_ (30,40,50,60);
array sumex[3] _temporary_  (5,10,10);

do i = 1 to dim(ex1);
   ex1[i] = ex1[i] / sumex[1];
   ex2[i] = ex2[i] / sumex[2];
   ex3[i] = ex3[i] / sumex[3];
   put ex1[i] = ex2[i] = ex3[i] =;
end;
p_m1 = 0; p_m2 = 0; p_m3 = 0;
do i = 1 to dim(ex1);
p_m1 = p_m1 + ex1[i] * ex3[i];
p_m2 = p_m2 + ex1[i] * ex2[i];
p_m3 = p_m3 + ex2[i] * ex3[i];
end;
put p_m1 = p_m2 = p_m3= ;  
run;

 On the Log:

 ex1[1]=2 ex2[1]=2 ex3[1]=3
 ex1[2]=4 ex2[2]=3 ex3[2]=4
 ex1[3]=6 ex2[3]=4 ex3[3]=5
 ex1[4]=8 ex2[4]=5 ex3[4]=6
 p_m1=100 p_m2=80 p_m3=68
&lt;/PRE&gt;
&lt;P&gt;The original values in the arrays ex1[ ], ex2[ ], ex3[ ] are modified in place by the appropriate division of sumx:&lt;/P&gt;
&lt;P&gt;Then the&amp;nbsp; product sums are simply the product of two parallel columns.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;DATAsp&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 14:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536240#M6607</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-02-17T14:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536735#M6658</link>
      <description>&lt;P&gt;Hi Gocersah,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I gave a solution on Sunday on what I thought you want. Perhaps it didn't help you. I appreciate that you respond to this. Tell us any issues with the solution offered.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATAsp&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 14:31:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536735#M6658</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-02-19T14:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536810#M6661</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17813"&gt;@KachiM&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I'm so sorry. Since I have posted another question, I did not notice your response. I'll try it and let you know as soon as I go home.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I appreciate for your response for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Feb 2019 16:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536810#M6661</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-02-19T16:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536962#M6699</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17813"&gt;@KachiM&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;I did try your code. Actually I don't know whether the order of statements important or not, but I placed your code into my existing code. I got an error says that p_m is out of range. I guess it is a simple error to be fixed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is all of my code and my input files&amp;nbsp; are attached. My all code will be more helpful to explain what I mean since I might not use proper terms.&lt;/P&gt;
&lt;P&gt;I appreciate for your help.&lt;/P&gt;
&lt;P&gt;data par;&lt;BR /&gt;infile 'C:\cluster_new\mlg1.txt';&lt;BR /&gt;input a1 a2 a3 b1 b2 b3 ;&lt;BR /&gt;run;&lt;BR /&gt;data score;&lt;BR /&gt;infile 'C:\cluster_new\mlgs.txt';&lt;BR /&gt;input theta1 theta2 theta3;&lt;BR /&gt;run;&lt;BR /&gt;data all_pars;&lt;BR /&gt;if _n_=1 then set score;&lt;BR /&gt;set par;&lt;BR /&gt;run;&lt;BR /&gt;data all_pars;&lt;BR /&gt;set all_pars;&lt;BR /&gt;s1=-(a1+a2+a3)/4;&lt;BR /&gt;s2=s1+a1;&lt;BR /&gt;s3=s1+a2;&lt;BR /&gt;s4=s1+a3;&lt;BR /&gt;inc1=-(b1+b2+b3)/4;&lt;BR /&gt;inc2=inc1+b1;&lt;BR /&gt;inc3=inc1+b2;&lt;BR /&gt;inc4=inc1+b3;&lt;BR /&gt;run;&lt;BR /&gt;data _null_;&lt;BR /&gt;length c $16000; /* 500*4*(up to &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; characters: " ex123_4" */&lt;BR /&gt;do i=1 to 3;&lt;BR /&gt;do j=1 to 4;&lt;BR /&gt;c=catx(' ',c,cats('ex',i,'_',j));&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;call symputx('vlist',c);&lt;BR /&gt;run;&lt;BR /&gt;data _null_;&lt;BR /&gt;array ex1[4] _temporary_ (10,20,30,40);&lt;BR /&gt;array ex2[4] _temporary_ (20,30,40,50);&lt;BR /&gt;array ex3[4] _temporary_ (30,40,50,60);&lt;BR /&gt;array sumex[3] _temporary_ (5,10,10);&lt;/P&gt;
&lt;P&gt;do i = 1 to dim(ex1);&lt;BR /&gt;ex1[i] = ex1[i] / sumex[1];&lt;BR /&gt;ex2[i] = ex2[i] / sumex[2];&lt;BR /&gt;ex3[i] = ex3[i] / sumex[3];&lt;BR /&gt;put ex1[i] = ex2[i] = ex3[i] =;&lt;BR /&gt;end;&lt;BR /&gt;p_m1 = 0; p_m2 = 0; p_m3 = 0;&lt;BR /&gt;do i = 1 to dim(ex1);&lt;BR /&gt;p_m1 = p_m1 + ex1[i] * ex3[i];&lt;BR /&gt;p_m2 = p_m2 + ex1[i] * ex2[i];&lt;BR /&gt;p_m3 = p_m3 + ex2[i] * ex3[i];&lt;BR /&gt;ex1[1]=2 ex2[1]=2 ex3[1]=3&lt;BR /&gt;ex1[2]=4 ex2[2]=3 ex3[2]=4&lt;BR /&gt;ex1[3]=6 ex2[3]=4 ex3[3]=5&lt;BR /&gt;ex1[4]=8 ex2[4]=5 ex3[4]=6&lt;BR /&gt;p_m1=100 p_m2=80 p_m3=68&lt;BR /&gt;end;&lt;BR /&gt;put p_m1 = p_m2 = p_m3= ; &lt;BR /&gt;run;&lt;BR /&gt;data all_pars1;&lt;BR /&gt;set all_pars (obs=20);;&lt;BR /&gt;array t {3} theta1-theta3 ;&lt;BR /&gt;array ex {3,4} &amp;amp;vlist; &lt;BR /&gt;array s {4};&lt;BR /&gt;array inc {4};&lt;BR /&gt;array sumex{3} 8.;&lt;BR /&gt;array p_m{4} ;&lt;BR /&gt;do i=1 to 3;&lt;BR /&gt;do j=1 to 4;&lt;BR /&gt;ex(i,j)=exp(t(i)*s(j)+inc(j));&lt;BR /&gt;sumex{i}=sum(sumex{i},ex{i,j});&lt;BR /&gt;ex(i,j)=exp(t(i)*s(j)+inc(j));&lt;BR /&gt;sumex{i}=sum(sumex{i},ex{i,j});&lt;BR /&gt;p_m(i)=sum((ex{i,j}/sumex{i})*(ex{i,j}/sumex{j}));&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 04:24:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536962#M6699</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-02-20T04:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536976#M6705</link>
      <description>&lt;P&gt;Gocersah,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I looked into your code (all_pars1). Instead of rewriting my code to suit you, I thought that you would be much helped if I can find the mistakes and suggest a change. Before we go to your code, I suggest some tips in using Arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[1] Use _temporary_ arrays when Variables are not needed in the PDV (Program Data Vector). Simply remember that such variables that do not go to OUTPUT Data Set be used in _temporary_ arrays -- which are used for intermediate computations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[2] Use square brackets('[ ]') instead of braces('{ }') or parentheses( '(&amp;nbsp; )' ). Both '{' and '(' require two key presses but square bracket requires one key press. Besides it can always be used for arrays everywhere in SAS (eg FCMP). Stick to one of it but don't mix them in a program. See your program for the mixed usage.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now your program. See whether your issue is fixed and the p_m[i] are OK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data all_pars1;
   set all_pars (obs=2); * (obs=20);;
   array t {3} theta1-theta3 ;
   array ex {3,4} &amp;amp;vlist;
   array s {4};
   array inc {4];
   array sumex{3} 8.;
   *array p_m{4} ;
   array p_m{3} ;
   do i=1 to 3;
      do j=1 to 4;
         ex(i,j)=exp(t(i)*s(j)+inc(j));
         sumex{i}=sum(sumex{i},ex{i,j});
         *ex(i,j)=exp(t(i)*s(j)+inc(j));
         *sumex{i}=sum(sumex{i},ex{i,j});
         *p_m(i)=sum((ex{i,j}/sumex{i})*(ex{i,j}/sumex{j}));
         p_m(i)=sum((ex{i,j}/sumex{i})*(ex{i,j}/sumex{i}));
      end;
      put p_m[i] =;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;Best of luck.&lt;/P&gt;
&lt;P&gt;DATAsp&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 06:47:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536976#M6705</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-02-20T06:47:42Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536980#M6707</link>
      <description>&lt;P&gt;So, no need to write the below part anymore? I did try the new code.I didn't get any errors but the results are different than what I have in excel.Expected p_m results are:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.30&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.31&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.31&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.38&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.35&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.35&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(just first three rows of excel)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you SO much!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;array ex1[4] _temporary_ (10,20,30,40);&lt;BR /&gt;array ex2[4] _temporary_ (20,30,40,50);&lt;BR /&gt;array ex3[4] _temporary_ (30,40,50,60);&lt;BR /&gt;array sumex[3] _temporary_ (5,10,10);&lt;/P&gt;
&lt;P&gt;do i = 1 to dim(ex1);&lt;BR /&gt;ex1[i] = ex1[i] / sumex[1];&lt;BR /&gt;ex2[i] = ex2[i] / sumex[2];&lt;BR /&gt;ex3[i] = ex3[i] / sumex[3];&lt;BR /&gt;put ex1[i] = ex2[i] = ex3[i] =;&lt;BR /&gt;end;&lt;BR /&gt;p_m1 = 0; p_m2 = 0; p_m3 = 0;&lt;BR /&gt;do i = 1 to dim(ex1);&lt;BR /&gt;p_m1 = p_m1 + ex1[i] * ex3[i];&lt;BR /&gt;p_m2 = p_m2 + ex1[i] * ex2[i];&lt;BR /&gt;p_m3 = p_m3 + ex2[i] * ex3[i];&lt;BR /&gt;end;&lt;BR /&gt;put p_m1 = p_m2 = p_m3= ; &lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 07:04:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/536980#M6707</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-02-20T07:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/537000#M6715</link>
      <description>&lt;P&gt;Please check the statement you wrote in SAS with EXCEL for p_m[i]. In SAS it is a SUM of squares. Also other statements too.&lt;/P&gt;
&lt;P&gt;Probably, you might have missed in the translation of Excel to SAS.&lt;/P&gt;
&lt;P&gt;DATAsp&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 09:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/537000#M6715</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-02-20T09:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: writing formula with arrays</title>
      <link>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/538058#M6858</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17813"&gt;@KachiM&lt;/a&gt;&amp;nbsp; Thank you SO much!&lt;/P&gt;</description>
      <pubDate>Sun, 24 Feb 2019 06:39:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/writing-formula-with-arrays/m-p/538058#M6858</guid>
      <dc:creator>dustychair</dc:creator>
      <dc:date>2019-02-24T06:39:21Z</dc:date>
    </item>
  </channel>
</rss>

