11-15-2016 06:46 PM
I'm trying to create a macro that will import 12 months worth of data from 12 separate files. I receive error messages that symbolic reference MTH01 and MON01 cannot resolve. I also receive an error 22-322: syntax error, expecting one of the following: ;, (, DATAFILE, DATATABLE, DBMS, DEBUG, FILE, OUT....etc. I thought that a macro previously defined in a program could later be invoked within a macro?
Can someone please tell me what I'm doing wrong or what I can do to correct this? Thank you very much in advance.
PROC IMPORT OUT=tpt_lvt_his_&MMYY.
DATAFILE= "\\xxxxxxx\xxxxxxx\xxxxx\xxxx\xxxxx\xxxx\&MONYY.\TPT_ora_apples_&MMYY. (from zzz Sharepoint).xls"
GETNAMES=YES; MIXED=NO; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES;
11-15-2016 06:52 PM
Is your endrsubmit early?
You need to compile the macro and macro variables in the same location - both locally or both on the server.
Your macro variable can't have quotes though, otherwise the code generated is:
MMYY resolves to -> '102016'
PROC IMPORT OUT=tpt_lvt_his_&MMYY. becomes
PROC IMPORT OUT=tpt_lvt_his_'102016'
This isn't valid SAS sytnax.
The code becomes simpler though: