Hi all, I have an Excel file which contains columns called : RAF 2016, RAF 2017, ..., RAF 2021 In the next year, we will have an additional column RAF 2022 Then in 2023, we will have RAF 2023 etc After importing the Excel file, i create a macro variable which contains the last_year in the Excel file (for example if the last column is RAF 2022, Last_year = 2022) In my program, i need to select the columns name dynamically. So, i prepare the name of the column using this : %let col1 = %str(%')RAF &i.%str(%'n); // i want here to prepare something like that : 'RAF 2016'n , 'RAF 2017'n ... to be able to use it as column name in the select %macro m2; %do i=2016 %to &Last_year.; %let col1 = %str(%')RAF &i.%str(%'n); PROC SQL; CREATE TABLE TOUT_SOLDE_3 AS SELECT t.*, t1.&col1. FROM TOUT_SOLDE_3 t LEFT JOIN TOUT_SOLDE_2 t1 ON t.UR = t1.UR and t.UE = t1.UE; QUIT; %end; %mend; But i have an error message : ERROR 22-322: Syntax error, expecting one of the following: a name, *. ERROR 76-322: Syntax error, statement will be ignored. I don't understand where is the issue. Can you help please ?
... View more