BookmarkSubscribeRSS Feed
podarum
Quartz | Level 8

Hi, does anyone know how I can set a specified start date and an end date in a time series, but not inperolate like in using proc timeseries or proc expand.. So if I have a series that starts in Mar'2005, but my start date for all series I set it to Jan'2000, then all the series start at Jan'2000 and will have blanks for each month from Jan'2000 to Mar'2005.. I can do this in Proc Timeseries, but it also interpolates (in case if there are missing holes in between) which I don't want.   Thanks

4 REPLIES 4
Ksharp
Super User

I don't understand what you mean totally.

What outpu do you like ?

If you only want a list of monthes.

data have;

do i=1 to 62;

  date=intnx('month','01jan2000'd,i);

  output;

end;

format date monyy.;

run;

Ksharp

podarum
Quartz | Level 8

Ok, if each of my series (Store by Product, over 500 of them) has data from let's say Mar'2005 to Jun'2009, with Pricing data that has some holes in between.. I would like to extend that period from Jan'2000 to Dec'2011 with simply leaving the beginning (eg. Jan'2000 to Mar'2005) with blanks/missing, and the ends (eg.Jun'2009 to Dec'2011) also having missing data.. BUT, the original holes that are in between Mar'2005 and Jun'2009 to NOT be filled in or interploated.  Proc Timeseries allows to create the end (Jan'2000) and end (Dec'2011) , but the problem is that it also interpolates the holes in between Mar'2005 and Jun'2009.

I have figured a way around it, but it's a 2 step process..

Step 1. Use Proc Timeseries to create the time frame as a shell, with meaningless info.. then Step 2. just merge the original Mar'2005 to Jun'2009 using a BY group, wiht the shell in Step1.

So it's dooable, but I wondered if there's something quicker through either proc timeseries or proc expand..I think for Proc Expand I can Chose METHOD=NONE, but don't know how I can pick a start and end date..

thanks

Tom
Super User Tom
Super User

Not sure what your data structure is.  But you can add extra observations where needed using something like this.

Assuming that GROUP identifies the the unique analysis groupings and DATE is your date variable (also asuming DATE is a SAS date variable).

data extra ;

   set have (keep=group date);

   by group;

   if first.group;

   date = '01JAN2000'd ;

   output;

   date = '01DEC2011'd ;

   output;

run;

data want ;

  merge extra have ;

  by group date;

run;

podarum
Quartz | Level 8

Thanks Tom, I thought of a similar approach, but using proc timeseries.. I'll give yours a try.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1698 views
  • 0 likes
  • 3 in conversation