Hi,
I have a 2 part question.
1. Having issues with proc x12.
This is my code, but the Output Data only produces the column for final seasonally adjusted data (D11) and not for
the original data (b1). Ideally I want both b1 and d11 right next to each other so I can quickly export to excel and do additional analysis.
proc x12 data= dividend_yield2 date=date;
var APAC;
OUTPUT OUT= b1 d11;
x11;
run;
2. For some varaibles, the data can be negative sometimes and when I try to run the same code with a different variable I get the following error message. How to get around this?
proc x12 data= dividend_yield2 date=date;
var LATAM;
OUTPUT OUT= b1 d11;
x11;
run;
--Then I get the following error message as this variable has some negative values.
ERROR: Multiplicative or log-additive seasonal adjustment cannot be done with a series with zero or negative values.
ERROR: An error was found in PROC X12 input. Processing skipped for variable LATAM.
In addition to Donna's suggestion, you can use the following code to select additive or multiplicative mode based on the data:
61 title "auto transform";
62 proc x12 data=series8 date=date2 seasons=4;
63 transform function=auto;
64 x11;
65 run;
NOTE: This release of the X12 procedure is based on the Census Bureau X-13ARIMA-SEATS Release Version 1.1.
WARNING: Automatic transformation selection cannot be done on a series with zero or negative values.
WARNING: Automatic transformation selection cannot be done on a series with zero or negative values.
NOTE: The PROCEDURE X12 printed pages 98-139.
You will get a warning about the negative values, but the decomposition will be done.
The default for the U.S. Census Bureau method is not to display the A1 and B1 tables if the tables are identical.
In this case, you can use the A1 table as the B1 table.
Hi,
Regarding your first question on PROC X12, you should be able to obtain your desired data set by adding an output data set name to the OUT= option in the OUTPUT statement. For example:
output out=out b1 d11;
This creates a data set called OUT with variables that contain the B1 and D11 series.
Regarding your second question on PROC X12, there are 4 seasonal adjustment modes: Multiplicative, Additive, Log-Additive, and Pseudo-Additive. The default seasonal adjustment mode is multiplicative. The multiplicative and log-additive modes require all data values to be greater than 0 (ie. strictly positive). The pseudo-additive mode requires all data values to be non-negative (ie. >= 0). Only the additive mode allows negative or zero values in the data. You can modify your X11 statement in your code as follows to specify the additive seasonal adjustment mode:
x11 mode=add;
For more details on these seasonal adjustment modes, please see the X11 statement documentation in the PROC X12 or PROC X13 documentation.
I hope this helps!
dw
In addition to Donna's suggestion, you can use the following code to select additive or multiplicative mode based on the data:
61 title "auto transform";
62 proc x12 data=series8 date=date2 seasons=4;
63 transform function=auto;
64 x11;
65 run;
NOTE: This release of the X12 procedure is based on the Census Bureau X-13ARIMA-SEATS Release Version 1.1.
WARNING: Automatic transformation selection cannot be done on a series with zero or negative values.
WARNING: Automatic transformation selection cannot be done on a series with zero or negative values.
NOTE: The PROCEDURE X12 printed pages 98-139.
You will get a warning about the negative values, but the decomposition will be done.
The default for the U.S. Census Bureau method is not to display the A1 and B1 tables if the tables are identical.
In this case, you can use the A1 table as the B1 table.
As Donna suggested, the format of the output statement is
OUTPUT OUT=<data set name> <tables>;
I think you omitted the data set name, and "b1" was used as the data set name.
Yes, thank you both.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.