Dear All I am trying to create a macro with wild card that can dynamically read a series of raw data files (txt data files). The raw data files have name (letters) with .txt extension followed by date_timestamp. The following samples represnt the raw data files. ZLGOPAR.txt.20140404_205224 VLSNHMONFCW.txt.20140404_212853 I have 50-60 raw data files like these. I tried to write a read in macro but it is not working. I have used filename = dfnVAR (in the inflie statement) whose length I want to use to extract Month, Year and FY etc as you can see below. Please take a look at what I wrote and help me resolve this issue. I am not sure if my infile statement is correct. Anyway, the idea is to be able to read all the raw datafiles dynamically by the macro. I would be grateful to your kind assistance and support. %LET Path = H:\STARS\Mar\FL; %LET dfnLEN = LENGTH(dfnVAR); %LET dfnSTART = dfnLEN – 15; %LET MONTH = substr(dfnVAR, dfnSTART + 5, 2); %LET FYread = substr(dfnVAR, dfnSTART + 3, 2); %LET FYint = input(FYread, 2.); %LET MONTHint = input(MONTH, 2.); IF MONTHint > 9 THEN FYint = FYint + 1; %LET FYstr = put(FYint, hex2.); %LET FY = CAT(“FY”, FYstr); %LET QRT = 0; %LET QRT_YR_FULL = CAT(“Q”, QRT, “FY20”, FYstr); %macro readindata(Table_In, Finalout, Month); data file1; infile "&Path\file*.txt" filename = dfnVAR eov = first_this_file end = done; Input ................................................................................................... ; if _n_ = 1 or first_this_file then Put 'Start reading ' dfnVAR=; run; IF MONTHint < 4 THEN QRT = 2; ELSE IF MONTHint < 7 THEN QRT = 3; ELSE IF MONTHint < 10 THEN QRT = 4; ELSE QRT = 1; %mend readindata; %readindata()
... View more