<?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: How to use Arrays to calculate Maximum value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412620#M279745</link>
    <description>1619 %macro import (file, dsn);&lt;BR /&gt;1620 proc import out = &amp;amp;dsn&lt;BR /&gt;1621 datafile = &amp;amp;file&lt;BR /&gt;1622 dbms = xlsx replace;&lt;BR /&gt;1623 getnames = yes;&lt;BR /&gt;1624 run;&lt;BR /&gt;1625 %mend import;&lt;BR /&gt;1626 %let import = "C:\project2_f17\project2.xlsx";&lt;BR /&gt;1627 %import (file=&amp;amp;import, dsn=project2);&lt;BR /&gt;&lt;BR /&gt;NOTE: The import data set has 91 observations and 3 variables.&lt;BR /&gt;NOTE: WORK.PROJECT2 data set was successfully created.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1628&lt;BR /&gt;1629 proc print data= project2;&lt;BR /&gt;NOTE: Writing HTML Body file: sashtml25.htm&lt;BR /&gt;1630 title "project 2 data";&lt;BR /&gt;1631 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.70 seconds&lt;BR /&gt;cpu time 0.42 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1632&lt;BR /&gt;1633 proc transpose data= project2 out= temp1 prefix= T;&lt;BR /&gt;1634 var time;&lt;BR /&gt;1635 by subject;&lt;BR /&gt;1636 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.04 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1637&lt;BR /&gt;1638 proc transpose data= project2 out= temp2 prefix= C;&lt;BR /&gt;1639 var concentration;&lt;BR /&gt;1640 by subject;&lt;BR /&gt;1641 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP2 has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.04 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1642&lt;BR /&gt;1643 data project2_transposed (drop=_name_ _label_);&lt;BR /&gt;1644 merge temp1 temp2;&lt;BR /&gt;1645 by subject;&lt;BR /&gt;1646 run;&lt;BR /&gt;&lt;BR /&gt;WARNING: Multiple lengths were specified for the variable _NAME_ by input data set(s). This can&lt;BR /&gt;cause truncation of data.&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP1.&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP2.&lt;BR /&gt;NOTE: The data set WORK.PROJECT2_TRANSPOSED has 7 observations and 27 variables.&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&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1647&lt;BR /&gt;1648 proc print data= project2_transposed;&lt;BR /&gt;1649 title "Project2 Part 2";&lt;BR /&gt;1650 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.PROJECT2_TRANSPOSED.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1651&lt;BR /&gt;1652 data temp3;&lt;BR /&gt;1653 set project2_transposed;&lt;BR /&gt;1654 array conc[13] C1-C13;&lt;BR /&gt;1655 Cmax= max(of conc{*});&lt;BR /&gt;1656 array times[13] T1-T13;&lt;BR /&gt;1657 Tmax= max(of times(of Cmax));&lt;BR /&gt;1658 by subject;&lt;BR /&gt;1659 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.PROJECT2_TRANSPOSED.&lt;BR /&gt;NOTE: The data set WORK.TEMP3 has 7 observations and 29 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1660&lt;BR /&gt;1661 proc print data= temp3;&lt;BR /&gt;1662 title "Part3";&lt;BR /&gt;1663 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP3.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1664&lt;BR /&gt;1665 data temp4;&lt;BR /&gt;1666 set project2;&lt;BR /&gt;1667 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP4 has 91 observations and 3 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1668&lt;BR /&gt;1669 proc means data = temp4 MEAN MIN;&lt;BR /&gt;1670 var concentration;&lt;BR /&gt;1671 by subject;&lt;BR /&gt;1672 title "MEAN and MIN of concentration";&lt;BR /&gt;1673 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.TEMP4.&lt;BR /&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;BR /&gt;real time 0.06 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Sat, 11 Nov 2017 23:14:37 GMT</pubDate>
    <dc:creator>mackenzies3</dc:creator>
    <dc:date>2017-11-11T23:14:37Z</dc:date>
    <item>
      <title>How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411796#M279739</link>
      <description>&lt;P&gt;I realize arrays are used to group data when you want to do process it all in one data step and it needs an array, do, end statement. I was instructed to transpose this data so that time and concentration would be variables and they would all show in relation to the subjects (observations). I was able to accomplish this by transposing each of the variables individually and then merging them. Now I am trying to find the maximum value of T and C for each observation using an array statement, but I just keep getting a bunch of errors. I am then supposed to find the mean, min and max which I know I can use the PROC MEANS statement, which I have done. When I do this final step, no errors show, but I am not getting any table to check the result. Below I've put the code I have come up with followed by the errors. Any guidance as to where I went wrong or what I am misunderstanding would be greatly appreciated. I am VERY new to SAS as you can probably tell.&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;proc import out=Project2_F17 
        datafile='C:\Users\savanahb\Downloads\Project2_f17.xlsx' DBMS=EXCEL2000 
        REPLACE;
    getnames=yes;
run;

data one;
    set Project2_F17 (keep=subject time concentration);
run;

proc sort data=one;
    by subject;
run;

proc transpose data=one out=two prefix=T;
    by subject;
    var time;
run;

proc transpose data=one out=three prefix=C;
    by subject;
    var concentration;
run;

data transposed;
    merge final final2;
    by subject;
run;

proc print data=transposed;
    title 'Transposed Data';
run;

data transposed;
    array max[13] T1-T13;
    maximum=max(of Time[*]);
    array max[13] C1-C13;
    maximum=max(of Concentration[*]);

    do n=i to 13;

        if max[i]=maximum then
            max=i;
    end;
    drop i;
run;

data Maximum;
    set transposed;
run;

proc print data=Maximum;
    title 'Maximum Values';
run;

proc means data=transposed;
    var T1-T13 C1-C13;
run;

data MMM;
    set transposed;
run;

proc print data=MMM;
    title 'Min Max Mean';&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;1523 proc import out=Project2_F17&lt;BR /&gt;1524 datafile= 'C:\Users\savanahb\Downloads\Project2_f17.xlsx'&lt;BR /&gt;1525 DBMS= EXCEL2000 REPLACE;&lt;BR /&gt;1526 getnames=yes;&lt;BR /&gt;1527 run;&lt;/P&gt;
&lt;P&gt;NOTE: WORK.PROJECT2_F17 data set was successfully created.&lt;BR /&gt;NOTE: The data set WORK.PROJECT2_F17 has 91 observations and 3 variables.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.31 seconds&lt;BR /&gt;cpu time 0.18 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1528&lt;BR /&gt;1529 data one;&lt;BR /&gt;1530 set Project2_F17 (keep = subject time concentration);&lt;BR /&gt;1531 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2_F17.&lt;BR /&gt;NOTE: The data set WORK.ONE has 91 observations and 3 variables.&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&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1532 proc sort data=one;&lt;BR /&gt;1533 by subject;&lt;BR /&gt;1534 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 91 observations read from the data set WORK.ONE.&lt;BR /&gt;NOTE: The data set WORK.ONE has 91 observations and 3 variables.&lt;BR /&gt;NOTE: PROCEDURE SORT used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1535&lt;BR /&gt;1536 proc transpose data=one out=two prefix = T;&lt;BR /&gt;1537 by subject;&lt;BR /&gt;1538 var time;&lt;BR /&gt;1539 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 91 observations read from the data set WORK.ONE.&lt;BR /&gt;NOTE: The data set WORK.TWO has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1540&lt;BR /&gt;1541 proc transpose data=one out=three prefix=C;&lt;BR /&gt;1542 by subject;&lt;BR /&gt;1543 var concentration;&lt;BR /&gt;1544 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 91 observations read from the data set WORK.ONE.&lt;BR /&gt;NOTE: The data set WORK.THREE has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1545&lt;BR /&gt;1546 data transposed;&lt;BR /&gt;1547 merge final final2;&lt;BR /&gt;1548 by subject;&lt;BR /&gt;1549 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.FINAL.&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.FINAL2.&lt;BR /&gt;NOTE: The data set WORK.TRANSPOSED has 7 observations and 27 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1550&lt;BR /&gt;1551 proc print data=transposed;&lt;BR /&gt;1552 title 'Transposed Data';&lt;BR /&gt;1553 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.TRANSPOSED.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1554&lt;BR /&gt;1555 data transposed;&lt;BR /&gt;1556 array max[13] T1-T13;&lt;BR /&gt;1557 maximum=max(of Time[*]);&lt;BR /&gt;NOTE: The array max has the same name as a SAS-supplied or user-defined function. Parentheses&lt;BR /&gt;following this name are treated as array references and not function references.&lt;BR /&gt;ERROR: Undeclared array referenced: Time.&lt;BR /&gt;ERROR: The ARRAYNAME[*] specification requires an array.&lt;BR /&gt;1558 array max[13] C1-C13;&lt;BR /&gt;---&lt;BR /&gt;124&lt;BR /&gt;ERROR 124-185: The variable max has already been defined.&lt;/P&gt;
&lt;P&gt;1559 maximum=max(of Concentration[*]);&lt;BR /&gt;ERROR: Undeclared array referenced: Concentration.&lt;BR /&gt;ERROR: The ARRAYNAME[*] specification requires an array.&lt;BR /&gt;1560 do n = i to 13;&lt;BR /&gt;1561 if max[i]=maximum then max=i;&lt;BR /&gt;ERROR: Illegal reference to the array max.&lt;BR /&gt;1562 end;&lt;BR /&gt;1563 drop i;&lt;BR /&gt;1564 run ;&lt;/P&gt;
&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.TRANSPOSED may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 28 variables.&lt;BR /&gt;WARNING: Data set WORK.TRANSPOSED 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.00 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1565&lt;BR /&gt;1566 data Maximum;&lt;BR /&gt;1567 set transposed;&lt;BR /&gt;1568 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.TRANSPOSED.&lt;BR /&gt;NOTE: The data set WORK.MAXIMUM has 7 observations and 27 variables.&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&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1569&lt;BR /&gt;1570 proc print data=Maximum;&lt;BR /&gt;1571 title 'Maximum Values';&lt;BR /&gt;1572 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.MAXIMUM.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1573&lt;BR /&gt;1574 proc means data=transposed;&lt;BR /&gt;1575 var T1-T13 C1-C13;&lt;BR /&gt;1576 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.TRANSPOSED.&lt;BR /&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;BR /&gt;real time 0.16 seconds&lt;BR /&gt;cpu time 0.07 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1577&lt;BR /&gt;1578 data MMM;&lt;BR /&gt;1579 set transposed;&lt;BR /&gt;1580 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.TRANSPOSED.&lt;BR /&gt;NOTE: The data set WORK.MMM has 7 observations and 27 variables.&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&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1581&lt;BR /&gt;1582 proc print data=MMM;&lt;BR /&gt;1583 title 'Min Max Mean';&lt;BR /&gt;1584 run;&lt;/P&gt;
&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.MMM.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.02 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 03:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411796#M279739</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-11-09T03:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411801#M279740</link>
      <description>&lt;P&gt;I edited your post to make your code legible. I highly, highly recommend you format your code and add comments. This step is your issue and you have a couple of them:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. No SET statement, so you have no input data&lt;/P&gt;
&lt;P&gt;2. DO NOT name your arrays the same name as SAS functions, that's a recipe for confusion.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. Once you change your array names, add the SET statement, you'll want to change your max functions to point to the new array names.&lt;/P&gt;
&lt;P&gt;4. You have no RUN at the end of your last PROC PRINT so that step will never finish.&lt;/P&gt;
&lt;P&gt;5. I think you're mixing up data set references, this is where comments can help you keep straight what your'e trying to do. In fact, I find that writing my comments - what I plan/need to do first is the best way to write code. Writing code is easy - figuring out what you need to do&amp;nbsp;is the hard part.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This step is the issue and see my comments below as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Good Luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data transposed;
    array max[13] T1-T13; &amp;lt;- don't use the name max here;
    maximum=max(of Time[*]); &amp;lt;- You have no array named Time so you can't refer to it that way
    array max[13] C1-C13; &amp;lt;- Same name as above? Each array needs it's own name
    maximum=max(of Concentration[*]); &amp;lt;- No array named concentration

    do n=i to 13; *No loop is needed, that's why we use arrays and the functions.

        if max[i]=maximum then
            max=i;
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 09 Nov 2017 03:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411801#M279740</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-09T03:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411813#M279741</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;! I like that idea of writing out what I have to do then doing the code. I think that will help a lot in the future.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 04:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411813#M279741</guid>
      <dc:creator>savanahb</dc:creator>
      <dc:date>2017-11-09T04:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411871#M279742</link>
      <description>&lt;P&gt;Really hard to follow your post.&amp;nbsp; From what I can tell you want to see min, max, mean of time and concentration at the end correct?&amp;nbsp; If so the whole transpose, arrays and such like is not needed:&lt;/P&gt;
&lt;PRE&gt;proc sql;
  create table WANT as
  select  SUBJECT,
          min(TIME) as MIN_TIME,
          max(TIME) as MAX_TIME,
          mean(TIME) as MEAN_TIME,
          min(CONCENTRATION) as MIN_CONCENTRATION,
          max(CONCENTRATION) as MAX_CONCENTRATION,
          mean(CONCENTRATION) as MEAN_CONCENTRATION
   from   HAVE
   group by SUBJECT;
quit;&lt;/PRE&gt;
&lt;P&gt;Obviously I am guessing a bit here as you have not provided any test data (in the form of a datastep) nor what the output should look like.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Nov 2017 11:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/411871#M279742</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-11-09T11:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412611#M279743</link>
      <description>&lt;P&gt;I'm actually in the same class as savanah and am having similar problems, although I still haven't been unable to figure it out.&lt;/P&gt;&lt;P&gt;I have completed all of the tasks correctly, except computing&amp;nbsp;&lt;SPAN&gt;T&lt;/SPAN&gt;max&lt;SPAN&gt;&amp;nbsp;. My professor did not go&amp;nbsp;beyond saying it was wrong.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For this part of the project I have:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; temp3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set project2_transposed;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array conc[&lt;STRONG&gt;13&lt;/STRONG&gt;] C1-C13;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cmax= max(of conc{*});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array times[&lt;STRONG&gt;13&lt;/STRONG&gt;] T1-T13;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tmax= max(of times(of Cmax);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by subject;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data= temp3;&lt;/P&gt;&lt;P&gt;title "Part3";&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, Cmax is correct, and I do not get any errors in my log. However, the output numbers from Tmax are incorrect. If anyone could offer any advice I would be grateful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Mackenzie&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 22:26:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412611#M279743</guid>
      <dc:creator>mackenzies3</dc:creator>
      <dc:date>2017-11-11T22:26:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412618#M279744</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177017"&gt;@mackenzies3&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm actually in the same class as savanah and am having similar problems, although I still haven't been unable to figure it out.&lt;/P&gt;
&lt;P&gt;I have completed all of the tasks correctly, except computing&amp;nbsp;&lt;SPAN&gt;T&lt;/SPAN&gt;max&lt;SPAN&gt;&amp;nbsp;. My professor did not go&amp;nbsp;beyond saying it was wrong.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For this part of the project I have:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; temp3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set project2_transposed;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array conc[&lt;STRONG&gt;13&lt;/STRONG&gt;] C1-C13;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Cmax= max(of conc{*});&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array times[&lt;STRONG&gt;13&lt;/STRONG&gt;] T1-T13;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Tmax= max(of times(of Cmax);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by subject;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;print&lt;/STRONG&gt; data= temp3;&lt;/P&gt;
&lt;P&gt;title "Part3";&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, Cmax is correct, and I do not get any errors in my log. However, the output numbers from Tmax are incorrect. If anyone could offer any advice I would be grateful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;Mackenzie&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177017"&gt;@mackenzies3&lt;/a&gt;&amp;nbsp;Post your log. I would expect errors from your code.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 23:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412618#M279744</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-11T23:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412620#M279745</link>
      <description>1619 %macro import (file, dsn);&lt;BR /&gt;1620 proc import out = &amp;amp;dsn&lt;BR /&gt;1621 datafile = &amp;amp;file&lt;BR /&gt;1622 dbms = xlsx replace;&lt;BR /&gt;1623 getnames = yes;&lt;BR /&gt;1624 run;&lt;BR /&gt;1625 %mend import;&lt;BR /&gt;1626 %let import = "C:\project2_f17\project2.xlsx";&lt;BR /&gt;1627 %import (file=&amp;amp;import, dsn=project2);&lt;BR /&gt;&lt;BR /&gt;NOTE: The import data set has 91 observations and 3 variables.&lt;BR /&gt;NOTE: WORK.PROJECT2 data set was successfully created.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1628&lt;BR /&gt;1629 proc print data= project2;&lt;BR /&gt;NOTE: Writing HTML Body file: sashtml25.htm&lt;BR /&gt;1630 title "project 2 data";&lt;BR /&gt;1631 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.70 seconds&lt;BR /&gt;cpu time 0.42 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1632&lt;BR /&gt;1633 proc transpose data= project2 out= temp1 prefix= T;&lt;BR /&gt;1634 var time;&lt;BR /&gt;1635 by subject;&lt;BR /&gt;1636 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP1 has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.04 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1637&lt;BR /&gt;1638 proc transpose data= project2 out= temp2 prefix= C;&lt;BR /&gt;1639 var concentration;&lt;BR /&gt;1640 by subject;&lt;BR /&gt;1641 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP2 has 7 observations and 16 variables.&lt;BR /&gt;NOTE: PROCEDURE TRANSPOSE used (Total process time):&lt;BR /&gt;real time 0.04 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1642&lt;BR /&gt;1643 data project2_transposed (drop=_name_ _label_);&lt;BR /&gt;1644 merge temp1 temp2;&lt;BR /&gt;1645 by subject;&lt;BR /&gt;1646 run;&lt;BR /&gt;&lt;BR /&gt;WARNING: Multiple lengths were specified for the variable _NAME_ by input data set(s). This can&lt;BR /&gt;cause truncation of data.&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP1.&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP2.&lt;BR /&gt;NOTE: The data set WORK.PROJECT2_TRANSPOSED has 7 observations and 27 variables.&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&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1647&lt;BR /&gt;1648 proc print data= project2_transposed;&lt;BR /&gt;1649 title "Project2 Part 2";&lt;BR /&gt;1650 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.PROJECT2_TRANSPOSED.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1651&lt;BR /&gt;1652 data temp3;&lt;BR /&gt;1653 set project2_transposed;&lt;BR /&gt;1654 array conc[13] C1-C13;&lt;BR /&gt;1655 Cmax= max(of conc{*});&lt;BR /&gt;1656 array times[13] T1-T13;&lt;BR /&gt;1657 Tmax= max(of times(of Cmax));&lt;BR /&gt;1658 by subject;&lt;BR /&gt;1659 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.PROJECT2_TRANSPOSED.&lt;BR /&gt;NOTE: The data set WORK.TEMP3 has 7 observations and 29 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1660&lt;BR /&gt;1661 proc print data= temp3;&lt;BR /&gt;1662 title "Part3";&lt;BR /&gt;1663 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 7 observations read from the data set WORK.TEMP3.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1664&lt;BR /&gt;1665 data temp4;&lt;BR /&gt;1666 set project2;&lt;BR /&gt;1667 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.PROJECT2.&lt;BR /&gt;NOTE: The data set WORK.TEMP4 has 91 observations and 3 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.03 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1668&lt;BR /&gt;1669 proc means data = temp4 MEAN MIN;&lt;BR /&gt;1670 var concentration;&lt;BR /&gt;1671 by subject;&lt;BR /&gt;1672 title "MEAN and MIN of concentration";&lt;BR /&gt;1673 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: There were 91 observations read from the data set WORK.TEMP4.&lt;BR /&gt;NOTE: PROCEDURE MEANS used (Total process time):&lt;BR /&gt;real time 0.06 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 11 Nov 2017 23:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412620#M279745</guid>
      <dc:creator>mackenzies3</dc:creator>
      <dc:date>2017-11-11T23:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412621#M279746</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177017"&gt;@mackenzies3&lt;/a&gt;&amp;nbsp;Your code here doesn’t match what you posted originally.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look at your two max formulas. They’re different. Make them think the same except for the name of the array. Delete it and start from scratch if that’s makes it easier.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 23:16:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412621#M279746</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-11T23:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412625#M279747</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Okay, I tried making the formulas the same&amp;nbsp;except for the arrays and put:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; temp3;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;set&lt;/SPAN&gt; project2_transposed;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;array&lt;/SPAN&gt; conc[&lt;SPAN&gt;&lt;STRONG&gt;13&lt;/STRONG&gt;&lt;/SPAN&gt;] C1-C13;&lt;/P&gt;&lt;P&gt;Cmax= max(of conc{*});&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;array&lt;/SPAN&gt; times[&lt;SPAN&gt;&lt;STRONG&gt;13&lt;/STRONG&gt;&lt;/SPAN&gt;] T1-T13;&lt;/P&gt;&lt;P&gt;Tmax= max(of times{*});&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;by&lt;/SPAN&gt; subject;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;print&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;data&lt;/SPAN&gt;= temp3;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;title&lt;/SPAN&gt; "Part3"&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The log I then is:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1674&amp;nbsp; data temp3;&lt;/P&gt;&lt;P&gt;1675&amp;nbsp; &amp;nbsp; &amp;nbsp; set project2_transposed;&lt;/P&gt;&lt;P&gt;1676&amp;nbsp; &amp;nbsp; &amp;nbsp; array conc[13] C1-C13;&lt;/P&gt;&lt;P&gt;1677&amp;nbsp; &amp;nbsp; &amp;nbsp; Cmax= max(of conc{*});&lt;/P&gt;&lt;P&gt;1678&amp;nbsp; &amp;nbsp; &amp;nbsp; array times[13] T1-T13;&lt;/P&gt;&lt;P&gt;1679&amp;nbsp; &amp;nbsp; &amp;nbsp; Tmax= max(of times{*});&lt;/P&gt;&lt;P&gt;1680&amp;nbsp; &amp;nbsp; &amp;nbsp; by subject;&lt;/P&gt;&lt;P&gt;1681&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.PROJECT2_TRANSPOSED.&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.TEMP3 has 7 observations and 29 variables.&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.04 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1682&lt;/P&gt;&lt;P&gt;1683&amp;nbsp; proc print data= temp3;&lt;/P&gt;&lt;P&gt;1684&amp;nbsp; title "Part3";&lt;/P&gt;&lt;P&gt;1685&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: There were 7 observations read from the data set WORK.TEMP3.&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; real time &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.04 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; cpu time&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 0.03 seconds&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So here I'm getting the maximum time, but not the time of the maximum&amp;nbsp;concentration for each subject, which is where I am finding myself getting extremely confused.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 23:27:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412625#M279747</guid>
      <dc:creator>mackenzies3</dc:creator>
      <dc:date>2017-11-11T23:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412626#M279748</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I guess I just am having trouble understanding how exactly to go from having the max of the concentration (Cmax), and max of time, to finding the time of the highest concentration (Tmax).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We have 13 times, and 13 concentrations for 7 different subjects.&lt;/P&gt;&lt;P&gt;and the highest time is 32 for all of the subjects, but the highest concentrations differ between each subject.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For instance, subject 1 has the highest concentration of 4.7 at time 2.&lt;/P&gt;&lt;P&gt;but then subject 2 has the highest concentration of 4.7 at time 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I'm very confused on how to make the Tmax = 2 for subject 1, but Tmax = 3 for subject 3 and so on.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone mentioned WHICHN(), but we have never talked about this in our class, so I'm not even sure where to start on that.&lt;/P&gt;</description>
      <pubDate>Sat, 11 Nov 2017 23:39:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412626#M279748</guid>
      <dc:creator>mackenzies3</dc:creator>
      <dc:date>2017-11-11T23:39:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412632#M279749</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177017"&gt;@mackenzies3&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I guess I just am having trouble understanding how exactly to go from having the max of the concentration (Cmax), and max of time, to finding the time of the highest concentration (Tmax).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ah. &amp;nbsp;See that’s a different question. Before you and the OP only asked for maximum of arrays.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is easier if you loop then.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which ever record is the max gets stored and you have the index so you can use the index to determine the time point.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh - and burn this part into your brain please - this is much easier if you don’t store your data in a wide format. Then you could sort and take the max easily.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See page 17 here&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/resources/papers/97529_Using_Arrays_in_SAS_Programming.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/97529_Using_Arrays_in_SAS_Programming.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you still need help post your code and log log back with what you’ve tried.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2017 01:15:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412632#M279749</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-12T01:15:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412729#M279750</link>
      <description>&lt;P&gt;Have you figured this out yet?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am stuck on the same step.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2017 21:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412729#M279750</guid>
      <dc:creator>briannagowin1</dc:creator>
      <dc:date>2017-11-12T21:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412730#M279751</link>
      <description>&lt;P&gt;Did you ever figure this out?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am stuck on the same step.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2017 21:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412730#M279751</guid>
      <dc:creator>briannagowin1</dc:creator>
      <dc:date>2017-11-12T21:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412742#M279752</link>
      <description>&lt;P&gt;Yes, I did. Here is the email I receive from the professor. It helped me a lot. Hope it helps you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;"TMAX is the the TIME value at which there is a Maximum concentration.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;We are not looking for the maximum time value.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Please note that you need to define 2 different ARRAYs, one for concentration values and another for TIME values. But you have the same array name for both. That is not correct.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Once you find the CMAX, you are going to use the two arrays: As an example, you would need a statement such as the following with DO and END statements&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;if c{i} = cmax then tmax = t{i};&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Hope this helps. I cannot give you anymore hint on this."&lt;/STRONG&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 12 Nov 2017 22:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412742#M279752</guid>
      <dc:creator>mackenzies3</dc:creator>
      <dc:date>2017-11-12T22:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412746#M279753</link>
      <description>I got this same response but I am still stuck!</description>
      <pubDate>Sun, 12 Nov 2017 22:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412746#M279753</guid>
      <dc:creator>briannagowin1</dc:creator>
      <dc:date>2017-11-12T22:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Arrays to calculate Maximum value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412759#M279754</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/177153"&gt;@briannagowin1&lt;/a&gt;&amp;nbsp;Did you try and follow the example in the link above with the direct page reference?&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 00:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-Arrays-to-calculate-Maximum-value/m-p/412759#M279754</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-13T00:29:06Z</dc:date>
    </item>
  </channel>
</rss>

