Hi @Kurt_Bremser, Thanks your for your help. Due to policy issues i really cant share the % freq macro.How ever, I have modified the code by the reference that you have given, and checked that a perticular type of syntax error is coming for all the variables. kindly have a look to my full code and the log error. %macro test1(s=); %do kk=1 %to %sysfunc(countw(&s,%str( ),q)); %let varname =%scan(&s,&kk.); data dd_&varname.; OPTIONS SPOOL; call execute(cats('%nrstr(%freq(DATASET = b2,TRT=trt, TRTFMT =_NONE_ ,BYVAR = _NONE_,FMTVAR= _NONE_,COND= _NONE_,PCTTYPE= COL,P= _NONE_,DENOMNODISP = _NO_, delALLDS= _YES_,MAXnumLEN= 6,clopper_pearson = _NONE_ VAR=' "&varname.,_,OUTDS=d_&varname.))")); run; %end; %mend test1; %test1(s=a t s ); Error in the log: GOPTIONS ACCESSIBLE; 26 %test1(s=a t s); NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.DD_a may be incomplete. When this step was stopped there were 0 observations and 0 variables. WARNING: Data set WORK.DD_a was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: Line generated by the macro variable "VARNAME". 26 "a,_,OUTDS=d_a __________________ 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.DD_t may be incomplete. When this step was stopped there were 0 observations and 0 variables. WARNING: Data set WORK.DD_t was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds NOTE: Line generated by the macro variable "VARNAME". 26 "t,_,OUTDS=d_t ________________________ 22 ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, *, **, +, ',', -, /, <, <=, <>, =, >, ><, >=, AND, EQ, GE, 2 The SAS System 20:53 Thursday, September 5, 2019 GT, LE, LT, MAX, MIN, NE, NG, NL, OR, ^=, |, ||, ~=. NOTE: The SAS System stopped processing this step because of errors. WARNING: The data set WORK.s may be incomplete. When this step was stopped there were 0 observations and 0 variables. WARNING: Data set WORK.DD_s was not replaced because this step was stopped. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.01 seconds Kindly hep with your suggestion.
... View more