BookmarkSubscribeRSS Feed
somebody
Lapis Lazuli | Level 10

I receive t he following error message when I ran the below code. Can anyone please figure out why? 

What my code is trying to do is to create a number of trading dates after each date in the temp_sample dataset

data temp_sample(drop=d d0 trdate t); 
	array trdates {200000} _temporary_; 
		if _n_=1 then do d=1 by 1 until (end_of_trcalendar); 
			set tradingdays (keep=trdate) end=end_of_trcalendar; 
			trdates{d}=trdate; 
		end; 
	set temp_sample ; 
	format date_t0 YYMMDD10.;
by &stockid. date; if first.date; date_t0=date; d0=whichn(date_t0,of trdates{*}); do T=1 to &holding_period.; date=trdates{d0+t}; output; end; rename date_t0=form_date; run;

And the error messages are:

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.



 

 

2 REPLIES 2
Tom
Super User Tom
Super User

You usually only see that for macro code, but your posted code has no macro definition or macro call.

Are you defining and using a macro?

Tom
Super User Tom
Super User

Make sure the values of the two undefined macro variables in your code are appropriate.

Not sure what you are trying to do, but perhaps you have indexed outside of your array? There are some simple things with loop boundaries you can do to make the logic better at preventing errors. 

if _n_=1 then do d=1 to dim(trdates) until (end_of_trcalendar); 
...
do T=1 to min(&holding_period.,dim(trdates)-d0+1);

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 5170 views
  • 0 likes
  • 2 in conversation