@Ronein:
If just want to hard code the macro variables' names in a DATA step, there're many ways to get what you want without using the CARDS/LINES/DATALINES, for example:
%let m0 = 1906 ;
%let m1 = 1905 ;
%let m2 = 1904 ;
%let m3 = 1903 ;
%let m4 = 1902 ;
%let m5 = 1901 ;
%let m6 = 1812 ;
data want ;
do YYMM = &m0, &m1, &m2, &m3, &m4, &m5, &m6 ;
output ;
end ;
run ;
Another way of going around CARDS is using SQL's INSERT clause instead where the macro variables will resolve just fine.
Frankly, I can't see how hard coding M0, M1, ... Mn can be practically utile. Even if you had a requirement of this sort, it would be normally given in a more general form, e.g.: Create a data set with a numeric YYMM variable whose values correspond to those of existing macro variables whose names start with M with digits only after that. In this case, you can construct a SYMGET function agrument based on this info, or auto-generate the DO loop above, or do many other things.
However, since you want to create a data set, why bother with any of the above if the names of all macro variables along with their values are already auto-stored in the system table dictionary.macros that can be read by SQL or accessed in the DATA step via the view sashelp.vmacro? Simply read either and filter by the macro scope and name as need be; for example:
data want (keep = YYMM) ;
set sashelp.vmacro (keep = name value) ;
where scope =: "G" and name =: "M" and notdigit (substr (trim (name), 2)) = 0 ;
YYMM = input (value, ?? yymmn4.) ; format yymm date9. ;
run ;
Kind regards
Paul D.
... View more