Good Morning, All.
I'm a new SAS developer and seem to be hitting a snag with a macro.
I'm getting the warnings:
WARNING: Apparent symbolic reference LASTDEPTKEY not resolved.
WARNING: Apparent symbolic reference LASTTODEPTKEY not resolved.
and error:
ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The condition was: &lastDeptKey=&lastToDeptKey or &validToDate="01JAN5999"
Here's the macro:
%let i=1; %let admUnit=%scan(&admUnits,1); %let fice=%scan(&ficeCodes,1); %do %while ( &admUnit > 0 ); %let x = 1; %let admUnitQry = &admUnit; %do %until ( (&x = 0) or (&x = 50) ) ; /*-- Loop through rows in crossing table for the adm_unit and move to adm units until the valid to date is '01JAN5999'd (last adm unit in the group - most current department) --*/ proc sql noprint; select b.department_key, b.to_department_key, b.valid_to_date, c.administrative_unit_no into :lastDeptKey, :lastToDeptKey, :validToDate, :lastAdmUnit from target.department_dim a, target.dept_key_x_to_dept_key_xing b, target.department_dim c where a.administrative_unit_no=&admUnitQry and a.fice_code=&fice and a.department_key=b.department_key and c.department_key=b.to_department_key; quit; %if &lastDeptKey=&lastToDeptKey or &validToDate="01JAN5999" %then %let x = 0; %else %do; %let x = %eval(&x + 1); %let admUnitQry = &lastAdmUnit; %end; %end; /* do until most current adm/dept is found */
I've used %put statements, but can't seem to find an error. Also, I've checked the datasets that these variables are pulling data from and the data appears good. I figure there's got to be something in the syntax. NOTE: the above isn't _all_ of the macro code, but a snippet that appears relevant.
Thanks!
... View more