<?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: Creating individual month columns based on date observation values. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584776#M166619</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285214"&gt;@JDDowell&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a new column for every month of the year from values in a date column which is formatted as follows...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01/01/2008&lt;/P&gt;
&lt;P&gt;02/01/2008&lt;/P&gt;
&lt;P&gt;03/01/2008&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;10/01/2019&lt;/P&gt;
&lt;P&gt;11/01/2019&lt;/P&gt;
&lt;P&gt;12/01/2019&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So every month of the year from '08-'19.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like all values of January to be in one columns, as well as columns for all the other individual months so that I can see the individual effects each month has on expenditure in a regression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought that I might be able to search the date columns for the "MM/" part of MM/DD/YY and ignore the rest with a wildcard, then add those values to a new column called "MM", but I didn't have any luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm very new to SAS and might not have even known if I was searching for the right question, so apologies if this has been answered elsewhere.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this for a report that people read or do you need a data set? Generally Reports show this sort of across behavior while data sets maintain a single record per date.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2019 20:39:57 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-08-28T20:39:57Z</dc:date>
    <item>
      <title>Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584716#M166579</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a new column for every month of the year from values in a date column which is formatted as follows...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Date:&amp;nbsp;&lt;/P&gt;&lt;P&gt;01/01/2008&lt;/P&gt;&lt;P&gt;02/01/2008&lt;/P&gt;&lt;P&gt;03/01/2008&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;10/01/2019&lt;/P&gt;&lt;P&gt;11/01/2019&lt;/P&gt;&lt;P&gt;12/01/2019&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So every month of the year from '08-'19.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like all values of January to be in one columns, as well as columns for all the other individual months so that I can see the individual effects each month has on expenditure in a regression.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought that I might be able to search the date columns for the "MM/" part of MM/DD/YY and ignore the rest with a wildcard, then add those values to a new column called "MM", but I didn't have any luck.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm very new to SAS and might not have even known if I was searching for the right question, so apologies if this has been answered elsewhere.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 18:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584716#M166579</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T18:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584725#M166587</link>
      <description>&lt;P&gt;I assume there are other variables that we need to make use of when we re-arrange the data set.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Can you show us a more realistic input data set, and the desired output data set? In particular, this isn't clear to me: "&lt;SPAN&gt;I would like all values of January to be in one columns". Do you mean there is one January column regardless of year, or is there a Jan08 column and a Jan09 column and so on?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 18:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584725#M166587</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-28T18:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584728#M166590</link>
      <description>&lt;P&gt;1) Is your data in external file or a sas dataset ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;If it is external then the date is probably a CHAR type.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;What format is the date: DD/MM/YYYY or MM/DD/YYYY ? It is not clear from your example dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;If it is a sas dataset, is the date a sas numeric date ? Maybe what you see is formated display ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) why do you want each month in separate column ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; Do you want it in a report ? or in a new sas dataset?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Post a sample of your dataset in a INFILE DATALINES step, and post it in the running men icon window.&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Post your code that you tried to run, the log and what issues did you have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 18:39:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584728#M166590</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-08-28T18:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584767#M166614</link>
      <description>&lt;P&gt;1) I imported the data from an excel file and I'm calling on that SAS table that was created. In the SAS table it says the input is in MMDDYY10. format.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) I would like to be able to regress expenditures on individual months.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expenditure= Int + Jan + Feb + Mar +...+ Nov + residuals&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The same data set is fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3)&lt;/P&gt;&lt;P&gt;I used the import wizard rather than self input code.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.SupportGoods;
    LENGTH
        FY               $ 6
        MOS                8
        Type               8
        Eligible           8
        PC_12MoAVG         8
        Total              8
        TotNoEFC           8
        PCNoEFC_12MoAVG    8
        FYTotals           8
        FYEligible         8
        FYPerCap           8
        FYTotal            8
        FYTotNoEFC         8
        FYPC_NoEFC         8 ;
    FORMAT
        FY               $CHAR6.
        MOS              MMDDYY10.
        Type             BEST4.
        Eligible         BEST11.
        PC_12MoAVG       BEST11.
        Total            BEST11.
        TotNoEFC         BEST11.
        PCNoEFC_12MoAVG  BEST11.
        FYTotals         BEST4.
        FYEligible       BEST11.
        FYPerCap         BEST11.
        FYTotal          BEST11.
        FYTotNoEFC       BEST11.
        FYPC_NoEFC       BEST11. ;
    INFORMAT
        FY               $CHAR6.
        MOS              MMDDYY10.
        Type             BEST4.
        Eligible         BEST11.
        PC_12MoAVG       BEST11.
        Total            BEST11.
        TotNoEFC         BEST11.
        PCNoEFC_12MoAVG  BEST11.
        FYTotals         BEST4.
        FYEligible       BEST11.
        FYPerCap         BEST11.
        FYTotal          BEST11.
        FYTotNoEFC       BEST11.
        FYPC_NoEFC       BEST11. ;
    INFILE 'C:\Users\doweljd\AppData\Local\Temp\SEG1848\SupportGoods-0b48c160721c43eda7d6c60c32977a3c.txt'
        LRECL=143
        ENCODING="WLATIN1"
        TERMSTR=CRLF
        DLM='7F'x
        MISSOVER
        DSD ;
    INPUT
        FY               : $CHAR6.
        MOS              : ?? MMDDYY9.
        Type             : ?? BEST4.
        Eligible         : ?? COMMA11.
        PC_12MoAVG       : ?? COMMA11.
        Total            : ?? COMMA11.
        TotNoEFC         : ?? COMMA11.
        PCNoEFC_12MoAVG  : ?? COMMA11.
        FYTotals         : ?? BEST4.
        FYEligible       : ?? COMMA11.
        FYPerCap         : ?? COMMA11.
        FYTotal          : ?? COMMA11.
        FYTotNoEFC       : ?? COMMA11.
        FYPC_NoEFC       : ?? COMMA11. ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SG.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32097i2A4B2E610E772202/image-size/large?v=v2&amp;amp;px=999" role="button" title="SG.PNG" alt="SG.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This was my idea of what would have created a new column for January if the date contained a substring for the month, but in retrospect if SAS stores it as a number I won't be able to search for a string value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data s_g;
	set sg;
	if mos in ('01/') then Jan=Total;
	if mos gt '01nov2018'd then
		delete;
	keep mos total;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The log doesn't give any errors, but the output data doesn't give anything either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 20:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584767#M166614</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T20:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584776#M166619</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285214"&gt;@JDDowell&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a new column for every month of the year from values in a date column which is formatted as follows...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01/01/2008&lt;/P&gt;
&lt;P&gt;02/01/2008&lt;/P&gt;
&lt;P&gt;03/01/2008&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;10/01/2019&lt;/P&gt;
&lt;P&gt;11/01/2019&lt;/P&gt;
&lt;P&gt;12/01/2019&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So every month of the year from '08-'19.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like all values of January to be in one columns, as well as columns for all the other individual months so that I can see the individual effects each month has on expenditure in a regression.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I thought that I might be able to search the date columns for the "MM/" part of MM/DD/YY and ignore the rest with a wildcard, then add those values to a new column called "MM", but I didn't have any luck.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm very new to SAS and might not have even known if I was searching for the right question, so apologies if this has been answered elsewhere.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is this for a report that people read or do you need a data set? Generally Reports show this sort of across behavior while data sets maintain a single record per date.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 20:39:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584776#M166619</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-28T20:39:57Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584778#M166621</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SG.1.PNG" style="width: 590px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32098i33DFA597769B3B81/image-size/large?v=v2&amp;amp;px=999" role="button" title="SG.1.PNG" alt="SG.1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You are correct, I would like for there to be a single January column containing different 'Total' values, a single column for February and so on.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 20:45:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584778#M166621</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T20:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584786#M166629</link>
      <description>&lt;P&gt;The more I talk about it the less certain I'm getting about if I'm even going about my question in the right way, but I'll try to explain my reasoning anyway.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My belief is that certain months have higher expenditures (the totals column) than others, and that this is consistent over the years. If I regress across the entire timeline then it is my understanding that I'm just going to forecast an average increase, and I won't be able to show these seasonal jumps that I perceive.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 21:00:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584786#M166629</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T21:00:41Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584788#M166631</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285214"&gt;@JDDowell&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The more I talk about it the less certain I'm getting about if I'm even going about my question in the right way, but I'll try to explain my reasoning anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My belief is that certain months have higher expenditures (the totals column) than others, and that this is consistent over the years. If I regress across the entire timeline then it is my understanding that I'm just going to forecast an average increase, and I won't be able to show these seasonal jumps that I perceive.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Do you have access to SAS/ETS? That does timeseries analysis of various flavors that account for things like seasonality (increased sales of snow skiing equipment in Fall vs spring for example).&lt;/P&gt;
&lt;P&gt;Those procedures understand dates for such things and no reshaping should be needed though you may need to specify the type of interval for collection (monthly instead of daily for instance).&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 21:05:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584788#M166631</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-28T21:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584797#M166639</link>
      <description>&lt;P&gt;Unfortunately I do not think my agency has a license for SAS/ETS, but I will email our IT. I was able to use PROC ARIMA to do time series analysis and was able to identify and adjust the model to a fair degree, but I don't entirely believe that I'm capturing the seasonal effect in my forecasted values. So I was trying to just do individual months.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a few years removed from school, so my econometrics knowledge has degraded. Perhaps this is not the best way to tackle this issue.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 21:33:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584797#M166639</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T21:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584802#M166641</link>
      <description>&lt;P&gt;I'm an idiot. I just realized I needed to change a parameter to get the desired monthly seasonality in my original ARIMA model. Thank you for your help.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 22:08:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/584802#M166641</guid>
      <dc:creator>JDDowell</dc:creator>
      <dc:date>2019-08-28T22:08:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating individual month columns based on date observation values.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/585033#M166759</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/285214"&gt;@JDDowell&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm an idiot. I just realized I needed to change a parameter to get the desired monthly seasonality in my original ARIMA model. Thank you for your help.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Proc Arima is in SAS/ETS, so apparently you have that module.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 18:31:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-individual-month-columns-based-on-date-observation/m-p/585033#M166759</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-29T18:31:07Z</dc:date>
    </item>
  </channel>
</rss>

