Forecasting using SAS Forecast Server, SAS/ETS, and more

Data Set For Forecasting

Reply
N/A
Posts: 0

Data Set For Forecasting

Hi all,
Plz find the solution for this problem.
I have demand dataset of parts at different plants from April 2001 to March 2008 as follows:

Plant Date Part Demand

1000 apr2001 ax1 23
2000 apr2001 ax1 34
1000 apr2001 ax2 43
2000 apr2001 ax2 53

1000 may2001 ax1 32
2000 may2001 ax1 54
1000 may2001 ax3 87

1000 June 2001 ax3 12
1000 June 2001 ax4 11
2000 June 2001 ax1 32

Now I want to subset dataset as:
1. Parts with first demand in apr2001 at each plant (Dataset from April 2001 to march 2008)
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.
3. Parts with first demand in June 2001 at each plant with exclusion of parts started in April 2001 and May 2001.

I mean I want to subset my data set as;
1. Whole data set (April 2001 to March2008) of parts (ax1 and ax2) which started in April2001 with each plant.
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).
3. Same For June 2001(ax4)


My approach is this way:


data want;
set test;
by part;
if first.part and put(date,monyy7.)='APR2001';
run;


The above code gives me only those parts that are ordered for first time.

O/p for above code is :
Plant Date part Demand
1000 APR2001 ax1 23
1000 APR2001 ax2 43

But this is not what I am interested because ax1 and ax2 part is also ordered for first time
on plant 2000,so my o/p should be this way:
Plant Date part Demand
1000 APR2001 ax1 23
1000 APR2001 ax1 34
2000 APR2001 ax1 34
2000 APR2001 ax2 53

If I just use apr2001 in if stmt I can get all values but still there will be duplicate values which will be added.


If I run the same query for month of may2001 with this code:

data want;
set test;
by part;
if first.part and put(date,monyy7.)='MAY2001';
run;

My o/p is this way:
Plant Date part Demand
1000 MAY2001 ax3 87
1000 MAY2001 ax5 87

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:

My o/p is this way:
Plant Date part Demand
1000 MAY2001 ax3 87
1000 MAY2001 ax5 87
5000 MAY2001 ax5 87




thanks
Ask a Question
Discussion stats
  • 0 replies
  • 180 views
  • 0 likes
  • 1 in conversation