BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
OceanDream
Fluorite | Level 6

I'm trying to use proc x12 to adjust seasonality. I use the following code. My data is quarterly. 

 

proc x12 data=HAVE date=yyqq interval=4 noprint;
by company_id;
var assets;
x11 mode=add outforecast;
output out=WANT;
run;

 

There is error showing "Time ID variable DATADATE contains gaps." This is because some of my observations ended the third quarter of the year instead of the fourth quarter of the year. Is there any way to fix this??

 

Also, those firms with adjusted assets results have the exact same values of adjusted assets with unadjusted assets. Is this because none of the firm in my data has seasonality pattern in terms of assets OR there is some mistake in my coding? Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
mitrov
SAS Employee

You can use PROC TIMESERIES to covert your data into a proper time series with no gaps in the dates. 

 

For example, this will set to 0 the values of all numerical variables for the dates for which there are no observations. You can look at the SETMISS= option in the manual to see other options. 

 

 proc timeseries data=have out=mseries;
      by company_id;
      id yyqq interval=quarter
                   accumulate=total
                   setmiss=0
      var _numeric_;
  run;

View solution in original post

1 REPLY 1
mitrov
SAS Employee

You can use PROC TIMESERIES to covert your data into a proper time series with no gaps in the dates. 

 

For example, this will set to 0 the values of all numerical variables for the dates for which there are no observations. You can look at the SETMISS= option in the manual to see other options. 

 

 proc timeseries data=have out=mseries;
      by company_id;
      id yyqq interval=quarter
                   accumulate=total
                   setmiss=0
      var _numeric_;
  run;

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1644 views
  • 0 likes
  • 2 in conversation