Hi, I have changed the dateset into montly frequency.
I want to full the missing value into zero.
For example, for ID=14593,
I like to obtatin the zero value from 2002M06 to 2018M05.
for ID=21020,
I like to obtain the zero value from 2002M06 to 2015M04.
I know I should use proc timesiries.
But, I can not figure out the problem.
Here is my code.
proc timeseries data=return
out =return1;
by ID day;
id month;
interval=month align=end format=MONTH. start="2002M06"Y end="Endday"M setmissing=0;
var RET;
run;
ID | day | Price | enday |
14593 | 20160429 | -0.00213 | 20180503 |
14593 | 20160531 | -0.00116 | 20180503 |
14593 | 20160606 | 0.001148 | 20180503 |
21020 | 20140226 | 0.088704 | 20150412 |
21020 | 20140331 | -0.03789 | 20150412 |
21020 | 20140430 | 0.111164 | 20150412 |
This is the log file
73: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the
LINE and COLUMN where the error has occurred.
ERROR 73-322: Expecting an INTERVAL.
76: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the
LINE and COLUMN where the error has occurred.
ERROR 76-322: Syntax error, statement will be ignored.
180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the
LINE and COLUMN where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.
49: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the
LINE and COLUMN where the error has occurred.
NOTE 49-169: The meaning of an identifier after a quoted string might change in
a future SAS release. Inserting white space between a quoted
string and the succeeding identifier is recommended.
49: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the
LINE and COLUMN where the error has occurred.
NOTE 49-169: The meaning of an identifier after a quoted string might change in
a future SAS release. Inserting white space between a quoted
string and the succeeding identifier is recommended.
And my other questions?
Is the data posted what you're starting out with? What do you expect as output?
Your code definitely has errors, for one it references variables not shown in your data set, such as RET, MONTH.
It is just a part of my dataset.
The log file show the error.
I like to obtain the data like this:
ID day Price
14593 200206 0
14593 … 0
14593 201601 0
14593 201602 0
14593 201603 0
14593 201604 -0.00213378
14593 201605 -0.001161069
14593 201606 0.001147585
14593 201607 0
14593 201608 0
14593 201609 0
14593 201610 0
14593 201611 0
14593 201612 0
14593 …..
14593 201805 0
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.