SAS Macro Variable Link Concatenation

The following code is read in the mobile phone bill from the excel file and does a lot of cleaning / reporting.

%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 the links for March. My initial idea below does not 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 produces 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 to get this link to a month variable for the correct update?

+4
source share
1 answer

Indicate the period after a month. therefore, SAS knows where the end of the macro variable is located. eg.

 PROC IMPORT OUT = PHONE.&month.min DATAFILE = "D:\Data\cellphone\&month.Bill.xls" 
+8
source

Source: https://habr.com/ru/post/1345900/


All Articles