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);

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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