<?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 DO LOOP HELP in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/DO-LOOP-HELP/m-p/610361#M18084</link>
    <description>&lt;P&gt;I have been working on this homework assignment all day and still have three questions I just cannot solve:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; There is a data file called VIRUS_PROLIF. Three variables: SAMPLE_NUMBER CELL_TYPE, and COUNT.&amp;nbsp; COUNT is a value for the initial count of the number of virions in a cell.&amp;nbsp; If we assume that the virions replicate at a rate such that the total number of virions will increase by 10% per minute, write the SAS code using DO UNTIL to calculate how long one would predict it would take (in minutes) for the number of virions to exceed 100,000 for each cell.&lt;/P&gt;&lt;P&gt;Then, write the SAS code using a data step and accumulating variables to calculate the minimum, maximum, and average time to exceed 100,000 virions for the cells of each CELL_TYPE.&lt;/P&gt;&lt;P&gt;Here is what I have for that one:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; VIRUS_PROLIF2;&lt;/P&gt;&lt;P&gt;set VIRUS_PROLIF;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until(COUNT&amp;gt;&lt;STRONG&gt;100000&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count+(Count*&lt;STRONG&gt;.01&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=VIRUS_PROLIF2 out=VIRUS_PROLIF3;&lt;/P&gt;&lt;P&gt;by SAMPLE_NUMBER CELL_TYPE COUNT;&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;data&lt;/STRONG&gt; CELL_TYPE_DATA (keep = SAMPLE_NUMBER CELL_TYPE COUNT n_cell_type min_cell_type max_Cell_type&lt;/P&gt;&lt;P&gt;avg_cell_type sum_Cell_type);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set Virus_Prolif3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by SAMPLE_NUMBER CELL_TYPE COUNT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain min_cell_type max_Cell_type sum_Cell_Type n_Cell_type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.Cell_Type then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_Cell_type = Cell_Type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_Cell_Type = Cell_Type;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum_Cell_Type = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_Cell_TYPE = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum_Cell_TYPE = sum(sum_Cell_TYPE, Cell_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_CELL_TYPE = sum(n_CELL_TYPE, &lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_CELL_TYPE = min(min_CELL_TYPE, CELL_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_CELL_TYPE = max(max_Cell_TYPE, CELL_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; avg_CELL_TYPE = sum_CELL_TYPE / n_CELL_TYPE;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.CELL_TYPE;&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;2. There is&amp;nbsp; data set 'HW3_Items'&amp;nbsp; contains the students' answers to a 25-question test (variables = answer_01 to answer_25).&amp;nbsp; On each student's observation, we also have variables for the correct answers (variables = correct_01 to correct_25).&amp;nbsp; Write a data step in which you will use arrays and a DO loop to determine each student's score on the test (1 point for each correct answer).&lt;/P&gt;&lt;P&gt;Here is what I have for that:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;data&lt;/STRONG&gt; HW3_ITEMS2;&lt;/P&gt;&lt;P&gt;Set HW3_ITEMS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Answer {&lt;STRONG&gt;25&lt;/STRONG&gt;} answer_01 - answer_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Correct_Answer {&lt;STRONG&gt;25&lt;/STRONG&gt;} correct_01 - correct_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Answer_Correct {&lt;STRONG&gt;25&lt;/STRONG&gt;} Answer_correct_01 - Answer_correct_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;do x = &lt;STRONG&gt;1&lt;/STRONG&gt; to &lt;STRONG&gt;25&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;if Answer[X] - Correct_Answer[X] = &lt;STRONG&gt;0&lt;/STRONG&gt; then Answer_Correct[X] = &lt;STRONG&gt;1&lt;/STRONG&gt; + x ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;else Answer_Correct[X] = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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=HW3_ITEMS2;&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;3. Last one is looking at overweight and normal weight individuals using data set sashelp.heart and I write the SAS code&amp;nbsp; to test whether the mean cholesterol level for normal weight subjects differed significantly from that of overweight subjects. I know that it is a ttest. But every time I try to do&amp;nbsp;proc ttest&lt;/P&gt;&lt;P&gt;data=sashelp.heart;&lt;BR /&gt;class Weight_Status;&lt;BR /&gt;var Chol_STATUS;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;There is an error and I am not sure why or how to fix it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise! Any advice would be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Dec 2019 02:15:46 GMT</pubDate>
    <dc:creator>K_Wils15</dc:creator>
    <dc:date>2019-12-09T02:15:46Z</dc:date>
    <item>
      <title>DO LOOP HELP</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DO-LOOP-HELP/m-p/610361#M18084</link>
      <description>&lt;P&gt;I have been working on this homework assignment all day and still have three questions I just cannot solve:&lt;/P&gt;&lt;P&gt;1)&amp;nbsp; There is a data file called VIRUS_PROLIF. Three variables: SAMPLE_NUMBER CELL_TYPE, and COUNT.&amp;nbsp; COUNT is a value for the initial count of the number of virions in a cell.&amp;nbsp; If we assume that the virions replicate at a rate such that the total number of virions will increase by 10% per minute, write the SAS code using DO UNTIL to calculate how long one would predict it would take (in minutes) for the number of virions to exceed 100,000 for each cell.&lt;/P&gt;&lt;P&gt;Then, write the SAS code using a data step and accumulating variables to calculate the minimum, maximum, and average time to exceed 100,000 virions for the cells of each CELL_TYPE.&lt;/P&gt;&lt;P&gt;Here is what I have for that one:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; VIRUS_PROLIF2;&lt;/P&gt;&lt;P&gt;set VIRUS_PROLIF;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; do until(COUNT&amp;gt;&lt;STRONG&gt;100000&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Count+(Count*&lt;STRONG&gt;.01&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sort&lt;/STRONG&gt; data=VIRUS_PROLIF2 out=VIRUS_PROLIF3;&lt;/P&gt;&lt;P&gt;by SAMPLE_NUMBER CELL_TYPE COUNT;&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;data&lt;/STRONG&gt; CELL_TYPE_DATA (keep = SAMPLE_NUMBER CELL_TYPE COUNT n_cell_type min_cell_type max_Cell_type&lt;/P&gt;&lt;P&gt;avg_cell_type sum_Cell_type);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set Virus_Prolif3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; by SAMPLE_NUMBER CELL_TYPE COUNT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; retain min_cell_type max_Cell_type sum_Cell_Type n_Cell_type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if first.Cell_Type then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_Cell_type = Cell_Type;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_Cell_Type = Cell_Type;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum_Cell_Type = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_Cell_TYPE = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sum_Cell_TYPE = sum(sum_Cell_TYPE, Cell_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n_CELL_TYPE = sum(n_CELL_TYPE, &lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min_CELL_TYPE = min(min_CELL_TYPE, CELL_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; max_CELL_TYPE = max(max_Cell_TYPE, CELL_TYPE);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; avg_CELL_TYPE = sum_CELL_TYPE / n_CELL_TYPE;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if last.CELL_TYPE;&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;2. There is&amp;nbsp; data set 'HW3_Items'&amp;nbsp; contains the students' answers to a 25-question test (variables = answer_01 to answer_25).&amp;nbsp; On each student's observation, we also have variables for the correct answers (variables = correct_01 to correct_25).&amp;nbsp; Write a data step in which you will use arrays and a DO loop to determine each student's score on the test (1 point for each correct answer).&lt;/P&gt;&lt;P&gt;Here is what I have for that:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;data&lt;/STRONG&gt; HW3_ITEMS2;&lt;/P&gt;&lt;P&gt;Set HW3_ITEMS;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Answer {&lt;STRONG&gt;25&lt;/STRONG&gt;} answer_01 - answer_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Correct_Answer {&lt;STRONG&gt;25&lt;/STRONG&gt;} correct_01 - correct_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array Answer_Correct {&lt;STRONG&gt;25&lt;/STRONG&gt;} Answer_correct_01 - Answer_correct_25;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;do x = &lt;STRONG&gt;1&lt;/STRONG&gt; to &lt;STRONG&gt;25&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;if Answer[X] - Correct_Answer[X] = &lt;STRONG&gt;0&lt;/STRONG&gt; then Answer_Correct[X] = &lt;STRONG&gt;1&lt;/STRONG&gt; + x ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;else Answer_Correct[X] = &lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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=HW3_ITEMS2;&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;3. Last one is looking at overweight and normal weight individuals using data set sashelp.heart and I write the SAS code&amp;nbsp; to test whether the mean cholesterol level for normal weight subjects differed significantly from that of overweight subjects. I know that it is a ttest. But every time I try to do&amp;nbsp;proc ttest&lt;/P&gt;&lt;P&gt;data=sashelp.heart;&lt;BR /&gt;class Weight_Status;&lt;BR /&gt;var Chol_STATUS;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;There is an error and I am not sure why or how to fix it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please advise! Any advice would be greatly appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 02:15:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DO-LOOP-HELP/m-p/610361#M18084</guid>
      <dc:creator>K_Wils15</dc:creator>
      <dc:date>2019-12-09T02:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: DO LOOP HELP</title>
      <link>https://communities.sas.com/t5/New-SAS-User/DO-LOOP-HELP/m-p/610386#M18092</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/295349"&gt;@K_Wils15&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will get more answers faster if you provide sample data, ask for one thing only per question and provide a desired output.&lt;/P&gt;
&lt;P&gt;Here the code for your first homework question.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data VIRUS_PROLIF;
  input SAMPLE_NUMBER CELL_TYPE $ COUNT;
  datalines;
1 xy 1000
2 xy 80000
3 xy 100000
4 xy 99999
;

data VIRUS_PROLIF2;
  set VIRUS_PROLIF;
  growth_time=0;
  if count&amp;lt;100000 then
    do;
      do until(COUNT&amp;gt;=100000);
        Count+(Count*.01);
        growth_time+1;
      end;
    end;
run;

/**
Then, write the SAS code using a data step and accumulating 
variables to calculate the minimum, maximum, and average time 
to exceed 100,000 virions for the cells of each CELL_TYPE.
**/
proc sort data=VIRUS_PROLIF2;
  by cell_type;
run;

data VIRUS_PROLIF3(keep=cell_type min_: max_: avg_:);
  set VIRUS_PROLIF2;
  by cell_type;
  retain min_growth_time max_growth_time;
  min_growth_time=min(growth_time, min_growth_time);
  max_growth_time=max(growth_time, max_growth_time);
  _n+1;
  _sum_growthtime+growth_time;
  if last.cell_type then
    do;
      avg_growth_time=_sum_growthtime/_n;
      output;
      call missing(of _:);
    end;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A Do Until clause always gets executed at least once so even if the cell count is already 100T+ you still would end-up with one iteration and though adding a minute. For this reason I had to add a test first (&lt;CODE class=" language-sas"&gt;if count&amp;lt;100000 then...&lt;/CODE&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it was me then I'd go for a DO While and would express the time it takes in seconds so that I can create a SAS Time value (which is the count in seconds). The code could then look like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data VIRUS_PROLIF2;
  set VIRUS_PROLIF;
  format growth_time time10.;
  do growth_time=0 by 60 while(COUNT&amp;lt;100000);
    Count+(Count*.01);
  end;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;....and hopefully one purpose of this exercise is to demonstrate that sometimes a little bit of math is very useful to speed-up processing and save computer resources.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2019 07:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/DO-LOOP-HELP/m-p/610386#M18092</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-12-09T07:15:28Z</dc:date>
    </item>
  </channel>
</rss>

