If you have the Cntlin/cntlout data set then the fun part is matching the distribution of start/end values with the values of the variables in the data set. It might be a fun programming exercise but I doubt that it would be short or even efficient.
That may be reduced if you have variable names that match some of the format names. Have you looked at that yet? Compare proc contents (dictionary.columnsoutput to a frequency of the CNTLIN data set FMTNAME
This may give you start:
/* this should find variable name matches to formatname*/
proc sql;
create table namematch as
select a.name,b.fmtname
from (select name from dictionary.columns
where libname='YOURLIB' and memname='YOURDATA') as a
left join (select distinct fmtname from YOURCNTLINDATASET) as b
on upcase(a.name)=(b.fmtname)
where upcase(a.name)=(b.fmtname);
quit;
/* this should find variable name matches where the variable name
is part of the format name*/
proc sql;
create table nearmatch as
select a.name,b.fmtname
from (select name from dictionary.columns
where libname='YOURLIB' and memname='YOURDATA') as a
,(select distinct fmtname from YOURCNTLINDATASET) as b
where index(upcase(b.fmtname),upcase(a.name))>0;
quit;
Note that hte libname and memname in dictionary.columns are uppercase. You will need to supply the data sets and libraries as needed.
If you get matches you should be able to create text of the format assignment statements. Easiest would be one statement for each matched variable. Note that the nearmatch will duplicate matches from the namematch.
... View more