The following code reads in a cellphone bill from an excel file and do a lot of cleaning / reports.
%LET month = March;
..........
PROC IMPORT OUT = PHONE.marchmin
DATAFILE = "D:\Data\cellphone\MarchBill.xls"
DBMS = EXCEL REPLACE;
SHEET = "Calls$";
GETNAMES = YES;
MIXED = YES;
SCANTEXT = YES;
USEDATE = YES;
SCANTIME = YES;
RUN;
To make my life easier, I'm trying to use a macro variable to update all of the references to March. My initial idea below, doesn't work.
%LET month = March;
.......
PROC IMPORT OUT = PHONE.&monthmin
DATAFILE = "D:\Data\cellphone\&monthBill.xls"
DBMS = EXCEL REPLACE;
SHEET = "Calls$";
GETNAMES = YES;
MIXED = YES;
SCANTEXT = YES;
USEDATE = YES;
SCANTIME = YES;
RUN;
It gives the following error:
WARNING: Apparent symbolic reference MONTHMIN not resolved.
1551 PROC IMPORT OUT= PHONE.&monthmin
-
22
ERROR 22-322: Syntax error, expecting one of the following: ;,
(, DATAFILE, DATATABLE, DBMS, FILE, OUT, REPLACE, TABLE.
How do I get that reference to the variable month to update correctly?
Put a period after &month. so SAS knows where the end of the macro variable is. e.g.
PROC IMPORT OUT = PHONE.&month.min
DATAFILE = "D:\Data\cellphone\&month.Bill.xls"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With