SAS大学版未解决明显的符号引用

时间:2018-04-26 17:58:33

标签: sas sas-macro

我正在尝试使用已发布的SAS程序识别我的数据集中的案例和控件。我是SAS新手,宏希望有人能够帮助排除故障。我收到以下错误 警告:未解析显式符号引用VCNT。

这是我的代码

data aggregate_all_11;
set aggregate_all_10 (rename=(age1=age));
run;

%LET AGERANGE=1; 
%LET RATIO=5;

DATA CASES CONTROLS;
SET aggregate_all_11;
IF abuser = 1 THEN OUTPUT CASES;
ELSE OUTPUT CONTROLS;


PROC FREQ NOPRINT DATA=CASES; 
TABLES age*gender/OUT=CASEOUT;


%MACRO SAMPLE(V_AGE,V_SEX,V_COUNT);
DATA QUALIFY1; 
SET CONTROLS;
WHERE (&V_AGE-&AGERANGE <=AGE<=&V_AGE+&AGERANGE)
AND (GENDER = '&V_SEX');

CASE_AGE=&V_AGE;
CASE_SEX='&V_SEX';

SEED=RANUNI(0);
 PROC SORT; BY SEED;

 DATA QUALIFY2;
 SET QUALIFY1 NOBS=TOTOBS;
 IF _N_<=&V_COUNT*&RATIO;
 IF &VCNT*&RATIO <= TOTOBS THEN TAG ='YES'; ELSE TAG ='NO';

 PROC APPEND BASE=MATCHES DATA=QUALIFY2;

 PROC SORT DATA=QUALIFY2 OUT=TEMP1(KEEP=UNIQUEID); BY UNIQUEID;

 PROC SORT DATA=CONTROL OUT=TEMP2;BY UNIQUEID;

 DATA CONTROL;
 MERGE TEMP1(IN=IN1) TEMP2(IN=IN2);
 BY UNIQUEID; IF IN2 AND NOT IN1;

 %MEND SAMPLE;

 DATA _NULL_; SET CASEOUT;
 CALL EXECUTE('%SAMPLE('||AGE||','||GENDER||','||COUNT||')');
 RUN;

LOG

 NOTE: Line generated by the CALL EXECUTE routine.
 1         +
 DATA QUALIFY2;  SET QUALIFY1 NOBS=TOTOBS;  IF _N_<=5*5;  IF &VCNT*5 <= TOTOBS THEN TAG ='YES'; ELSE

 _                                                                                                                                   

 22
 WARNING: Apparent symbolic reference VCNT not resolved.
 ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, 
               a missing value, INPUT, PUT.  

 2         + TAG ='NO';

 NOTE: The SAS System stopped processing this step because of errors.
 WARNING: The data set WORK.QUALIFY2 may be incomplete.  When this step was stopped there were 0 observations and 46 variables.
 WARNING: Data set WORK.QUALIFY2 was not replaced because this step was stopped.
 NOTE: DATA statement used (Total process time):

0 个答案:

没有答案