Just provide a space at beginning of () in the <span></span>while statement. <div><br></div><div>While (yr&lt;=yr2)</div><div><br></div><div>It should work.<br><br>On Wednesday, 15 June 2016, Justin Hicks &lt;<a href="mailto:jhicks2014@gmail.com">jhicks2014@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Now, with the same exact script, it is giving me the error<div><br></div><div> &quot;Unable to locate ENDWHILE statement for the WHILE statement at line 14<div>  In file DailytoMonthlyTest.gs&quot;</div><div><br></div><div>This is the error I was previously dealing with, yet it resolved itself with no changes. I&#39;m not too sure what&#39;s going on, both endwhile statements are there.</div><div><br></div><div>-Justin </div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 9, 2016 at 12:32 PM, Jeff Duda <span dir="ltr">&lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jeffduda319@gmail.com&#39;);" target="_blank">jeffduda319@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The code looks fine to me other than the following line:<br><br><div> &#39;open file /data2/control/GPCC_FirstGuessDaily&#39;<br><br></div><div>Remove &#39;file&#39; from this command.<br><br></div><div>Jeff Duda<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Thu, Jun 9, 2016 at 10:10 AM, Justin Hicks <span dir="ltr">&lt;<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;jhicks2014@gmail.com&#39;);" target="_blank">jhicks2014@gmail.com</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">To whom it may concern,<div><br></div><div>I&#39;m working on converting a plethora of datasets, many of them with daily and hourly temporal resolutions, into a monthly temporal resolution. </div><div><br></div><div>I am unsure how to write a script that I can run that changes, in this case, average daily data into average monthly data, with respect to leap years and such. I have tried to follow scripts from other users who have previously posted here, but they did not seem to work. </div><div><br></div><div>There is an example of the script I tried to run on this page: <a href="http://gradsusr.org/pipermail/gradsusr/2006-June/003290.html" target="_blank">http://gradsusr.org/pipermail/gradsusr/2006-June/003290.html</a></div><div><br></div><div>This is the script I am currently running: </div><div><br></div><div><div>reinit</div><div>mday = &#39;31 28 31 30 31 30 31 31 30 31 30 31&#39;</div><div>month = &#39;jan feb mar apr may jun jul aug sep oct nov dec&#39;</div><div><br></div><div> &#39;open file /data2/control/GPCC_FirstGuessDaily&#39;</div><div><br></div><div> &#39;set gxout fwrite&#39;</div><div> &#39;set fwrite /data2/control/GPCC_FirstGuessDailyScriptTest&#39;</div><div><br></div><div> yr1 = 2009</div><div> yr2 = 2013</div><div><br></div><div> yr = yr1</div><div> while(yr&lt;=yr2)</div><div> leap = 0</div><div>  if(math_mod(yr,400) = 0 | math_mod(yr,4) = 0 &amp; math_mod(yr,100) != 0)</div><div>   leap = 1</div><div>   say yr&#39; is a leap year.&#39;</div><div>  endif</div><div>  imon = 1</div><div>  while(imon &lt;= 12)</div><div>   md = subwrd(mday,imon)</div><div>   mc = subwrd(month,imon)</div><div>   if(imon = 2); md = md + leap; endif;</div><div>  time1 = &#39;01&#39;mc&#39;&#39;yr</div><div>   time2 = md&#39;&#39;mc&#39;&#39;yr</div><div>*   say time1&#39; &#39;time2</div><div>   &#39;d ave(p,time=&#39;time1&#39;,time=&#39;time2&#39;)&#39;</div><div>   imon = imon + 1</div><div>  endwhile</div><div>  yr = yr + 1</div><div> endwhile</div></div><div><br></div><div><br></div><div>Running this code gives me an error saying that it cannot open the file, yet it is pointed to the correct directory. However, it does output saying that &#39;2012 is a leap year&#39; which is correct.</div><div><br></div><div>Any help would be appreciated, as I&#39;m a terrible coder. </div><span><font color="#888888"><div><br></div><div>-Justin</div></font></span></div>
<br></div></div>_______________________________________________<br>
gradsusr mailing list<br>
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;gradsusr@gradsusr.org&#39;);" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br><div data-smartmail="gmail_signature"><div dir="ltr"><div>Jeff Duda<br>Post-doctoral research associate<br>University of Oklahoma School of Meteorology<br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;gradsusr@gradsusr.org&#39;);" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br></div>
</blockquote></div>