SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Nested do loop error

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

Nested do loop error

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

 


Accepted Solutions
Solution
‎02-22-2017 05:52 AM
Super User
Posts: 17,829

Re: Nested do loop error

You Forgot the ampersand, 

 

&j. 

View solution in original post


All Replies
Solution
‎02-22-2017 05:52 AM
Super User
Posts: 17,829

Re: Nested do loop error

You Forgot the ampersand, 

 

&j. 

Occasional Contributor
Posts: 9

Re: Nested do loop error

Thanks Reeza.

 

Embarrassed Ed

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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