<?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 do I calculate julian dates from month-year data organized in columns in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669453#M200824</link>
    <description>Hi,&lt;BR /&gt;Thank you for a quick response - so much appreciated!&lt;BR /&gt;I just tried the code. However, I realize it is not quite what I had in mind...&lt;BR /&gt;I need to have the date as a decimal date (centred on the middle of each month) so not a real julian day. Sorry, I should have made that clearer in the first post. Every month (centred on the middle of the month so for example January would get a decimal value of 0.5/12 = 0.042) should be expressed as a fraction of the year, and accumulate during the year to a whole year, so the next year starts again with a decimal value. Like this...&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.792&lt;BR /&gt;&lt;BR /&gt;1856.792&lt;BR /&gt;&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.875&lt;BR /&gt;&lt;BR /&gt;1856.875&lt;BR /&gt;&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.958&lt;BR /&gt;&lt;BR /&gt;1856.958&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.042&lt;BR /&gt;&lt;BR /&gt;1857.042&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.125&lt;BR /&gt;&lt;BR /&gt;1857.125&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.208&lt;BR /&gt;&lt;BR /&gt;1857.208&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there a way to create a decimal year value like this?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 15 Jul 2020 13:55:00 GMT</pubDate>
    <dc:creator>bmac1</dc:creator>
    <dc:date>2020-07-15T13:55:00Z</dc:date>
    <item>
      <title>How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669435#M200821</link>
      <description>&lt;P&gt;Hi SAS community,&lt;/P&gt;&lt;P&gt;I have a data set of observations for different months in different years (spanning over 100 years), with the monthly&amp;nbsp; data arranged in 12 columns for each year as below:&lt;/P&gt;&lt;P&gt;Year&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jan&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feb&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mar&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; apr&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; may&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jun&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; jul&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aug&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sep&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; oct&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nov&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dec&lt;/P&gt;&lt;P&gt;1856&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.235&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.168&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.159&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.211&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.234&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.247&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.224&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.291&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.141&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.152&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.246&lt;/P&gt;&lt;P&gt;1857&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.231&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.042&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.058&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.024&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.016&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.117&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.149&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.014&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.036&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.117&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.152&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.266&lt;/P&gt;&lt;P&gt;1858&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.204&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.297&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.054&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.228&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.106&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.023&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.144&amp;nbsp;&amp;nbsp;&amp;nbsp; -0.055&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.087&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.165&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.291&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.139&lt;/P&gt;&lt;P&gt;I want to convert the year-month data into a single long time series of julian dates, so that the observation of the first month in the first year (1856) gets assigned a julian date = 1856 + (0.5/12) = 1856.042, and so on.&amp;nbsp; The output file should have the new date variable in its own column, and the corresponding observation for that julian date, as below:&lt;/P&gt;&lt;P&gt;1856.041&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.235&lt;/P&gt;&lt;P&gt;1856.125&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.168&lt;/P&gt;&lt;P&gt;1856.208&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0.24&lt;/P&gt;&lt;P&gt;...etc.&lt;/P&gt;&lt;P&gt;Has anyone some suggestions or code to do this (in SAS version 9)?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for help.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 12:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669435#M200821</guid>
      <dc:creator>bmac1</dc:creator>
      <dc:date>2020-07-15T12:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669437#M200822</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE */
data want;
    set have;
    array x(*) jan--dec;
    do i=1 to dim(x);
        juldate = juldate(mdy(i,1,year));
        value=x(i);
        output;
     end;
     keep juldate value;
     format juldate julian7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 13:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669437#M200822</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-15T13:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669453#M200824</link>
      <description>Hi,&lt;BR /&gt;Thank you for a quick response - so much appreciated!&lt;BR /&gt;I just tried the code. However, I realize it is not quite what I had in mind...&lt;BR /&gt;I need to have the date as a decimal date (centred on the middle of each month) so not a real julian day. Sorry, I should have made that clearer in the first post. Every month (centred on the middle of the month so for example January would get a decimal value of 0.5/12 = 0.042) should be expressed as a fraction of the year, and accumulate during the year to a whole year, so the next year starts again with a decimal value. Like this...&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.792&lt;BR /&gt;&lt;BR /&gt;1856.792&lt;BR /&gt;&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.875&lt;BR /&gt;&lt;BR /&gt;1856.875&lt;BR /&gt;&lt;BR /&gt;1856&lt;BR /&gt;&lt;BR /&gt;0.958&lt;BR /&gt;&lt;BR /&gt;1856.958&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.042&lt;BR /&gt;&lt;BR /&gt;1857.042&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.125&lt;BR /&gt;&lt;BR /&gt;1857.125&lt;BR /&gt;&lt;BR /&gt;1857&lt;BR /&gt;&lt;BR /&gt;0.208&lt;BR /&gt;&lt;BR /&gt;1857.208&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is there a way to create a decimal year value like this?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Jul 2020 13:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669453#M200824</guid>
      <dc:creator>bmac1</dc:creator>
      <dc:date>2020-07-15T13:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669472#M200833</link>
      <description>&lt;P&gt;For not standard values such as below, please indicate the actual date each is supposed to represent:&lt;/P&gt;
&lt;P&gt;1856&lt;/P&gt;
&lt;P&gt;0.792&lt;/P&gt;
&lt;P&gt;1856.792&lt;/P&gt;
&lt;P&gt;1856&lt;/P&gt;
&lt;P&gt;0.875&lt;/P&gt;
&lt;P&gt;1856.875&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;None of those resemble a Julian date in any form. Julian dates are YYDDD or YYYYDDD where Y is year and DDD is a 3-digit number of the day in a year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you may also want to include some other months worked out just to make sure we understand how you are mangling month.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 14:30:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669472#M200833</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-07-15T14:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669482#M200836</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE */
data want;
    set have;
    array x(*) jan--dec;
    do i=1 to dim(x);
        juldate = year+(i-0.5)/12;
        value=x(i);
        output;
     end;
     keep juldate value;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jul 2020 14:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669482#M200836</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-07-15T14:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669737#M200943</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This worked perfectly! Thank you so much for your help.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Jul 2020 22:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669737#M200943</guid>
      <dc:creator>bmac1</dc:creator>
      <dc:date>2020-07-15T22:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I calculate julian dates from month-year data organized in columns</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669738#M200944</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for replying. What I need is not really a julian date, but a decimal year date.&amp;nbsp; Sorry I did not make that clear enough in the original post.&amp;nbsp; &amp;nbsp;In the meantime another community member has solved the question.&amp;nbsp; Please see the other posts in this thread for information.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2020 22:24:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-calculate-julian-dates-from-month-year-data-organized/m-p/669738#M200944</guid>
      <dc:creator>bmac1</dc:creator>
      <dc:date>2020-07-15T22:24:27Z</dc:date>
    </item>
  </channel>
</rss>

