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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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