03-27-2016 08:59 PM - edited 03-27-2016 09:00 PM
Using SAS EG 7.1.
Below is only part of my macro, but it is where the problem occurs. How do I solve it? THank you
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was:
&MONTHF =12 and &MONTHQ=06
%IF &MONTHF =12 and &MONTHQ =06 %THEN %DO;
%DO YEAR=&FIRSTYR %TO %eval(&LASTYR-1);
%let YEARQ = %eval(&YEAR);
F&YEAR.&MONTHF (IN=A) QC&YEARQ.&MONTHQ(IN=B);
IF A AND B Or (A AND Age=0);
03-27-2016 10:27 PM
03-27-2016 11:53 PM
Your macro variables Year and YearQ are identical - I would recommend keeping only one.
I would consider simplifying your macro's. Write a single macro that stacks or merges your datasets the way you want. Create a dataset that has the list of datasets to merge and then use call execute to execute your macro. It will be easier to debug and modify in my opinion. Obviously this is a style choice, but I find macro loops to be unwieldy at the best of times.
I'm also wondering about your process...did you create all these separate monthly files, and is there a way to avoid that in the first place. This is usually why the recommendation comes to not split our data sets!