BookmarkSubscribeRSS Feed
asch1234
Calcite | Level 5

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;

 

 

IDdayPriceenday
1459320160429-0.0021320180503
1459320160531-0.0011620180503
14593201606060.00114820180503
21020201402260.08870420150412
2102020140331-0.0378920150412
21020201404300.11116420150412
4 REPLIES 4
Reeza
Super User
So what you've shown is what you have? Based on that, can you show what you expect as the output? Does your code run with errors? Can you include the log too?
asch1234
Calcite | Level 5

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.

Reeza
Super User

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. 

 

 

asch1234
Calcite | Level 5

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

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

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
  • 649 views
  • 0 likes
  • 2 in conversation