BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tsetredst
Calcite | Level 5

Hi,

 

I am trying to create a nested loop but I am getting an error. I am getting the error message: 'Expecting an relational or arithmetic operator'

 

The code I am using is as follows:

 

%macro nested_reg;
%do j = 2 %to 3;

%macro variables;
%do i = 1 %to 69;

data regress_&i.(drop = ceiling cdist time_L_ lvol mkt midpoint counter);
set org_dual.dual_&i.;

lvol = log(volume); lvol1 = lag(lvol); lvol2 = lag2(lvol); lvol3 = lag3(lvol); 

if cdist1 <= j. then m=1;
else m=0;

The error flags at the line  (Expecting an relational or arithmetic operator'):

if cdist1 <= j. then m=1;
else m=0;

I was hoping that the value of 'j' would be subsituted in here. This is not working, can anyone help me with this issue?

 

Thanks,

 

Ed

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

You Forgot the ampersand, 

 

&j. 

View solution in original post

2 REPLIES 2
Reeza
Super User

You Forgot the ampersand, 

 

&j. 

tsetredst
Calcite | Level 5

Thanks Reeza.

 

Embarrassed Ed

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

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