<?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 Data Set For Forecasting in SAS Forecasting and Econometrics</title>
    <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Data-Set-For-Forecasting/m-p/42864#M193</link>
    <description>Hi all,&lt;BR /&gt;
Plz find the solution for this problem.&lt;BR /&gt;
I have demand dataset of parts at different plants from April 2001 to March 2008 as follows:&lt;BR /&gt;
&lt;BR /&gt;
Plant 		Date      	Part 	Demand&lt;BR /&gt;
&lt;BR /&gt;
1000   		apr2001    	 ax1 	  23&lt;BR /&gt;
2000 		apr2001   	 ax1 	  34&lt;BR /&gt;
1000  		apr2001   	 ax2	  43&lt;BR /&gt;
2000  		apr2001   	 ax2 	  53&lt;BR /&gt;
&lt;BR /&gt;
1000  		may2001  	 ax1  	  32&lt;BR /&gt;
2000  		may2001            ax1       54&lt;BR /&gt;
1000	             may2001           ax3         87&lt;BR /&gt;
&lt;BR /&gt;
1000		June 2001	ax3	  12&lt;BR /&gt;
1000		June 2001	ax4 	  11&lt;BR /&gt;
2000		June 2001	ax1	   32&lt;BR /&gt;
&lt;BR /&gt;
Now I want to subset dataset as:&lt;BR /&gt;
1. Parts with first  demand in apr2001 at each plant (Dataset from April 2001 to march 2008)  &lt;BR /&gt;
2. Parts with first  demand in may 2001 at each plant (Dataset from May 2001 to March 2008) with exclusion of parts started in April 2001.&lt;BR /&gt;
3. Parts with first demand in June 2001 at each plant with exclusion of parts started in April 2001 and May 2001.&lt;BR /&gt;
&lt;BR /&gt;
I mean I want to subset my data set as;&lt;BR /&gt;
1. Whole data set (April 2001 to March2008) of parts (ax1 and ax2) which started in April2001 with each plant.&lt;BR /&gt;
2. Whole data set (May 2001 to March 2008) of part (ax3) stated in May 2001 with each plant but not already present in April 2001 (not of ax1 and ax2).&lt;BR /&gt;
3. Same For June 2001(ax4)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My approach is this way:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set test;&lt;BR /&gt;
by part;&lt;BR /&gt;
if first.part and put(date,monyy7.)='APR2001';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The above code gives me only those parts that are ordered for first time.&lt;BR /&gt;
&lt;BR /&gt;
O/p for above code is :&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        APR2001    ax1                  23&lt;BR /&gt;
1000        APR2001    ax2                  43&lt;BR /&gt;
&lt;BR /&gt;
But this is not what I am interested because ax1 and ax2 part is also ordered for first time&lt;BR /&gt;
 on plant 2000,so my o/p should be this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        APR2001    ax1                  23&lt;BR /&gt;
1000        APR2001    ax1                  34&lt;BR /&gt;
2000        APR2001    ax1                  34&lt;BR /&gt;
2000        APR2001    ax2                 53&lt;BR /&gt;
&lt;BR /&gt;
If I just use apr2001 in if stmt I can get all values but still there will be duplicate values which will be added.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If I run the same query for month of may2001 with this code:&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set test;&lt;BR /&gt;
by part;&lt;BR /&gt;
if first.part and put(date,monyy7.)='MAY2001';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My o/p is this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        MAY2001  ax3                 87&lt;BR /&gt;
1000        MAY2001  ax5                87&lt;BR /&gt;
&lt;BR /&gt;
But this is not again correct because part ax5 . is also  placed for order for first time even on plant 5000 ,so that record should also be added in my o/p:&lt;BR /&gt;
&lt;BR /&gt;
My o/p is this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        MAY2001  ax3                 87&lt;BR /&gt;
1000        MAY2001  ax5                87&lt;BR /&gt;
5000       MAY2001  ax5                87&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
thanks</description>
    <pubDate>Wed, 10 Jun 2009 11:09:46 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-06-10T11:09:46Z</dc:date>
    <item>
      <title>Data Set For Forecasting</title>
      <link>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Data-Set-For-Forecasting/m-p/42864#M193</link>
      <description>Hi all,&lt;BR /&gt;
Plz find the solution for this problem.&lt;BR /&gt;
I have demand dataset of parts at different plants from April 2001 to March 2008 as follows:&lt;BR /&gt;
&lt;BR /&gt;
Plant 		Date      	Part 	Demand&lt;BR /&gt;
&lt;BR /&gt;
1000   		apr2001    	 ax1 	  23&lt;BR /&gt;
2000 		apr2001   	 ax1 	  34&lt;BR /&gt;
1000  		apr2001   	 ax2	  43&lt;BR /&gt;
2000  		apr2001   	 ax2 	  53&lt;BR /&gt;
&lt;BR /&gt;
1000  		may2001  	 ax1  	  32&lt;BR /&gt;
2000  		may2001            ax1       54&lt;BR /&gt;
1000	             may2001           ax3         87&lt;BR /&gt;
&lt;BR /&gt;
1000		June 2001	ax3	  12&lt;BR /&gt;
1000		June 2001	ax4 	  11&lt;BR /&gt;
2000		June 2001	ax1	   32&lt;BR /&gt;
&lt;BR /&gt;
Now I want to subset dataset as:&lt;BR /&gt;
1. Parts with first  demand in apr2001 at each plant (Dataset from April 2001 to march 2008)  &lt;BR /&gt;
2. Parts with first  demand in may 2001 at each plant (Dataset from May 2001 to March 2008) with exclusion of parts started in April 2001.&lt;BR /&gt;
3. Parts with first demand in June 2001 at each plant with exclusion of parts started in April 2001 and May 2001.&lt;BR /&gt;
&lt;BR /&gt;
I mean I want to subset my data set as;&lt;BR /&gt;
1. Whole data set (April 2001 to March2008) of parts (ax1 and ax2) which started in April2001 with each plant.&lt;BR /&gt;
2. Whole data set (May 2001 to March 2008) of part (ax3) stated in May 2001 with each plant but not already present in April 2001 (not of ax1 and ax2).&lt;BR /&gt;
3. Same For June 2001(ax4)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
My approach is this way:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set test;&lt;BR /&gt;
by part;&lt;BR /&gt;
if first.part and put(date,monyy7.)='APR2001';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The above code gives me only those parts that are ordered for first time.&lt;BR /&gt;
&lt;BR /&gt;
O/p for above code is :&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        APR2001    ax1                  23&lt;BR /&gt;
1000        APR2001    ax2                  43&lt;BR /&gt;
&lt;BR /&gt;
But this is not what I am interested because ax1 and ax2 part is also ordered for first time&lt;BR /&gt;
 on plant 2000,so my o/p should be this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        APR2001    ax1                  23&lt;BR /&gt;
1000        APR2001    ax1                  34&lt;BR /&gt;
2000        APR2001    ax1                  34&lt;BR /&gt;
2000        APR2001    ax2                 53&lt;BR /&gt;
&lt;BR /&gt;
If I just use apr2001 in if stmt I can get all values but still there will be duplicate values which will be added.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
If I run the same query for month of may2001 with this code:&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
set test;&lt;BR /&gt;
by part;&lt;BR /&gt;
if first.part and put(date,monyy7.)='MAY2001';&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My o/p is this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        MAY2001  ax3                 87&lt;BR /&gt;
1000        MAY2001  ax5                87&lt;BR /&gt;
&lt;BR /&gt;
But this is not again correct because part ax5 . is also  placed for order for first time even on plant 5000 ,so that record should also be added in my o/p:&lt;BR /&gt;
&lt;BR /&gt;
My o/p is this way:&lt;BR /&gt;
Plant         Date            part                Demand&lt;BR /&gt;
1000        MAY2001  ax3                 87&lt;BR /&gt;
1000        MAY2001  ax5                87&lt;BR /&gt;
5000       MAY2001  ax5                87&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
thanks</description>
      <pubDate>Wed, 10 Jun 2009 11:09:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Forecasting-and-Econometrics/Data-Set-For-Forecasting/m-p/42864#M193</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-06-10T11:09:46Z</dc:date>
    </item>
  </channel>
</rss>

