<?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: Create a monthly dataset in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943142#M42366</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;, it isn't immediately apparent what your end goal is here. Are you hoping to create separate datasets for each month (eg. a JAN dataset, a FEB dataset...). If you could please provide a sample input dataset and what you would like the output datasets to contain, along with code you've tried.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2024 13:45:12 GMT</pubDate>
    <dc:creator>antonbcristina</dc:creator>
    <dc:date>2024-09-09T13:45:12Z</dc:date>
    <item>
      <title>Create a monthly dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943135#M42365</link>
      <description>&lt;P&gt;Hi guys,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to create a dataset containing months from 01JAN2014 to 31DEC2022 like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;01JAN2014&lt;/P&gt;
&lt;P&gt;01FEB2014&lt;/P&gt;
&lt;P&gt;01MAR2014&lt;/P&gt;
&lt;P&gt;.......................&lt;/P&gt;
&lt;P&gt;01JAN2022&lt;/P&gt;
&lt;P&gt;.......................&lt;/P&gt;
&lt;P&gt;01DEC2022&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Can anyone help me please?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 13:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943135#M42365</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-09-09T13:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943142#M42366</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;, it isn't immediately apparent what your end goal is here. Are you hoping to create separate datasets for each month (eg. a JAN dataset, a FEB dataset...). If you could please provide a sample input dataset and what you would like the output datasets to contain, along with code you've tried.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 13:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943142#M42366</guid>
      <dc:creator>antonbcristina</dc:creator>
      <dc:date>2024-09-09T13:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943145#M42368</link>
      <description>Hi thank you for your feedback! I need to create a single dataset with one column as I showed. Nothing more. I have no input data. I only have to create the dataset ex novo.</description>
      <pubDate>Mon, 09 Sep 2024 13:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943145#M42368</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2024-09-09T13:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943146#M42369</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.abc;
 do i=0 to 100;
  maand = INTNX('MONTH','01JAN2014'd,i,'SAMEDAY');
  output;
 end;
 format maand MONYY5.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 13:52:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943146#M42369</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-09-09T13:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: Create a monthly dataset</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943149#M42370</link>
      <description>&lt;P&gt;There's a few ways to achieve this. You could use DO loops to go through all of the years and months, and the &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0bo5thbfrcab1n1menkqxq2suiv.htm" target="_self"&gt;MDY function&lt;/A&gt; to construct the date using the first of each month like so:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	do y=2014 to 2022;
		do m=1 to 12;
			date=mdy(m,01,y);
			output;
		end;
	end;
	format date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Alternatively, you could use the &lt;A href="https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm#n1lchasgjah7ran0z2wlmsbfwdx2" target="_self"&gt;INTNX function&lt;/A&gt; to increment by one month from a chosen start date, and use a DO UNTIL loop to ensure you've reached your desired end date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want2;
	date="01jan2014"d; 
	output;
	do until (date&amp;gt;="01dec2022"d);
		date = intnx("MONTH",date,1,"BEGINNING");
		output;
	end;
	format date date9.;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2024 14:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-monthly-dataset/m-p/943149#M42370</guid>
      <dc:creator>antonbcristina</dc:creator>
      <dc:date>2024-09-09T14:07:38Z</dc:date>
    </item>
  </channel>
</rss>

