Hello
I want to create multiple macro variables based on data set that contain 2 colums:
column 1 is Macro var name
Column 2 is the value that the macro var will get
for example:
Macro var M0 will get value 2309
Macro var M1 will get value 2308
and so on
What is the way to do it please?
I think that I did it well but when I write %put &&m&n..; to see the last macro var then I get warning and cannot see its value.Why???
WARNING: Apparent symbolic reference M not resolved. 26 %put &&m&n..; &m..
%let startMon=2012;
%let LastMon=2309;
data _null_;
date_start=mdy(mod(&startMon,100),1,floor(&startMon/100));
date_end=mdy(mod(&LastMon,100),1,floor(&LastMon/100));
n = intck('month',date_start,date_end);
call symputx('n',put(counter,best.));
call symputx('date_start',put(date_start,best.));
call symputx('date_end',put(date_end,best.));
format date_start date_end date9.;
run;
data want_month;
date=&date_start.;
end_date=&date_end.;
YYMM=input(put(date,yymmn4.),best.);
format date end_date date9.;
do while (date<=end_date);
output;
date=intnx('month', date, 1, 's');
YYMM=input(put(date,yymmn4.),best.);
end;
format date YYMMN4.;
drop date end_date;
run;
proc sort data=want_month;
by descending YYMM ;
Run;
DATA want_month2(DROP=seq);
SET want_month;
seq = _N_-1;
Macro_Var_Name=CATS("M",seq);
RUN;
data _null_;
set want_month2;
call symputx(Macro_Var_Name,YYMM);
run;
%put &M0;
%put &M1;
%put &M33;
%put &&m&n..;/******Why WARNING: Apparent symbolic reference M not resolved??????***/
... View more