I'm having this macro. The aim is to take the name of variables from the table dicofr and put the rows inside into variable name using a symput. However , something is not working correctly because that variable, &nvarname, is not seen as a variable. This is the content of dico&&pays&l
varname descr
var12 aza
var55 ghj
var74 mcy
This is the content of dico&&pays&l..1
varname
var12
var55
var74
Below is my code
%macro testmac; %let pays1=FR ; %do l=1 %to 1 ;
data dico&&pays&l..1 ;
set dico&&pays&l (keep=varname); call symput("nvarname",trim(left(_n_))) ;
run ;
data a&&pays&l; set a&&pays&l;
nouv_date=mdy(substr(date,6,2),01,substr(date,1,4));
format nouv_date monyy5.;
run;
proc sql; create table toto (nouv_date date , nomvar varchar (12)); quit;
proc sql; insert into toto SELECT max(nouv_date),'&nvarname' as nouv_date as varname FROM a&&pays&l WHERE (&nvarname ne .);
%end;
%mend;
%testmac;
A subsidiary question. Is it possible to have the varname and the date related to that varname into a macro variable? My man-a told me about this but I have never done that before. Thanks in advance.
... View more