SAS said there is syntax error for &j:
%MACRO calnum;
%DO j=1 %TO 2;
%DO i=1 %TO 10;
PROC UNIVARIATE DATA=work.data&j;
VAR diff;
OUTPUT OUT=work.pctile&j%SYSFUNC(PUTN(&i,z2.)) PCTLPRE=P&j_ PCTLPTS=1 to 100 BY 1;
RUN;
%END;
%END;
%MEND;
It seemed that the use of work.data&j is fine, but it is error to specify it as: PCTLPRE=P&j_
How can I put this right?
please change
PCTLPRE=P&j_ PCTLPTS=1 to 100 BY 1; to
PCTLPRE=P&j._ PCTLPTS=1 to 100 BY 1;
please change
PCTLPRE=P&j_ PCTLPTS=1 to 100 BY 1; to
PCTLPRE=P&j._ PCTLPTS=1 to 100 BY 1;
LinLin's answer should solve the problem. SAS will interpret &J_ as a request to expand the non existent macro variable named J_. Placing the period after the J will let SAS know that you want to expand the value of the macro variable J instead.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: