11-08-2013 06:00 AM
I am trying to feed the values k =1-100 and l = 1-100 into another macro called 'time' where K NOT EQUAL L.
This is what I have so far.
The script is erroring because it is trying to feed in characters 'K' & 'L' instead of their integer values.
%DO K = 1 %TO 100 %BY 1;
%DO L = 1 %TO 100 %BY 1;
%IF I NE J %THEN;
Can anyone help?
11-08-2013 06:46 AM
Thanks this has helped one problem.
Can I only use IF THEN ELSE statements in datasteps?
I don't want to create a dataset here just want to put a conditional clause on running my macro.
11-08-2013 07:08 AM
%if %then %else are macro statements only valid within a macro (unlike say %let which can be in open code).
if then else are data step statements, only valid within a data step.
You have to be very careful not to mix the two, especially if you have a data step within a macro.
Message was edited by: Richard Carson
11-10-2013 09:59 AM
You are not coding the %IF/%THEN code properly.
%if <condition> %then <statement> ;
In your code ( %IF I NE J %THEN;) you have left the <statement> part empty.
11-10-2013 10:55 AM
%put here in time a=&a;
%put here in time b=&b;
%DO K = 1 %TO 100 ;
%DO L = 1 %TO 100 ;
%IF &K. NE &L. %THEN
%put entered in else ;