FILENAME FTPFILE FTP '' LS
HOST = "&FTPHST"
USER = "&FTPUSR"
PASS = "&FTPPAS"
CD = "&FTPCD\&PGMSEC";
DATA _NULL_;
INFILE FTPFILE;
INPUT;
IF _INFILE_ EQ "&PGMMTH" THEN CALL SYMPUT('LEVEL0','Y');
RUN;
HOST = "&FTPHST"
USER = "&FTPUSR"
PASS = "&FTPPAS"
CD = "&FTPCD\&PGMSEC"
RCMD = "MKD &PGMMTH";
DATA _NULL_;
IF "&LEVEL0" EQ 'N' THEN
DO;
INFILE FTPFILE;
INPUT;
END;
RUN;