Programming the statistical procedures from SAS

Help with Tools

Posts: 53

Help with Tools

I am looking for a way in sas to look at component changes over time. 


- data set that contains material_used quantities with date from 2011-2015

      data set looks like this:

          Unit#,      Date,           Part#,     Qty_used   

          345     01jan2014     5d3423          5

          2034   23feb2015     6t5453          10

          to many years of data

- data set that contains Expected 2015 usage(but is total for the year)

          dataset looks like

               Year,      Part#,      Expected_Qty_used

               2015     5d3423          400

               2015     6t5453          700

I would like to take the trend data by month from the first data set and then figure out from previous usages how many i think i should use in the current year based on the previous years.

Is there a tool or method in sas that could do this for me?

If not are there any suggestions on how i go about this?


Valued Guide
Posts: 862

Re: Help with Tools

I have a start here but I'm not sure what you are trying to do.

data have;

infile cards dsd;

informat date date9.;

format date date9.;

input Unit$ Date Part$ Qty_used ;






data have2;

infile cards dsd;

input Year Part$ Expected_Qty_used;






proc sql;

create table start as

select a.*,b.year,b.Expected_Qty_used

from have a left join

     have2 b on

a.part = b.part;

Posts: 53

Re: Help with Tools

Posted in reply to Steelers_In_DC

Sorry I know i am not explaining this well.  Let me try again.

From my first data set there is many years and about a million records.  I want to figure out from all that previous history by part number and month an average trend across the year.  I then want to use that trend to change my second data set from a yearly total into a monthly trend based on past  history of that part.   I need to do that so I can compare my expected usage to my actual usage and account for the trends of previous history.

I hope this helps

Thank you

Super User
Posts: 11,780

Re: Help with Tools

I think you need to provide an example of what you expect the final output to look like.

I can't tell if you are trying to run a regression to forecast or to partition an annual total into monthly components.

Do any of your part usages have an actual seasonality such as a use of snow-blower parts which might tend to be used in winter or some such? If so you are likely looking at something from the SAS/ETS module and the project will go much better using those tools.

Likely the first step would be to summarize your part usage to a monthly level which might be something like:

proc summary data=material_used nway;

     class partNumber date;

     var Qty_Used;

     output out=MonthTotals (drop=_type_) sum=;

     format date YYMON7. ;


Posts: 53

Re: Help with Tools

Yes many parts do have actual seasonality.  Is there a statistical test that can be used to Validate this?

Output i am looking for would look like this

Part#YearMonthActualQuantityExpected Quantity

Total expected for 2015 based on past trends

So basically I need to take a 1 year estimated Number and generate the properly weighted values by month based on the past trend data.  This i hope will allow me to see if I am out of the box on the estimated numbers early in the year.  I am not a statistician but do have a good understanding of sas programing and I am really looking for Ideas on what tools i need and the process to go through to get to this end result.

Thank you so much for all your time.

Super User
Posts: 11,780

Re: Help with Tools

I think you might want to move this to the Forecasting area as this bit of data looks seasonal to me ant the Time Series procedures, which I don't have access to, as part of SAS/ETS look much more likely to be helpful.

Without ETS, if, and this is a big if, you have enough years of data you might run a regression by part and month with year as the independent variable. It wouldn't be very sensitive though and unless the trends are pretty consistent not very precise.

Ask a Question
Discussion stats
  • 5 replies
  • 3 in conversation