x cd /pub/data/georef/Tools; %let pgm=aaa_cnty; filename pgm "&pgm..sas"; *--Read the Missouri county to AAA (Area Agency on Aging) Codes and names. Generate the cntyaaa and aaaname format codes.---; filename in '../aaa.csv'; filename aaafmat '/pub/sas/formats/Saaa.sas'; filename cntyaaa '/pub/sas/formats/Scntyaaa.sas'; title "georef.&pgm"; libname georef '/pub/data/georef'; data georef.aaa_cnty georef.aaanames(drop=fipco county); infile in dsd missover; length fipco county $5 aaa $2 aaaname cntyname $24; input fipco cntyname aaa aaaname; county=fipco; if length(aaa)=1 then aaa='0'||aaa; if aaaname='Northest' then aaaname='Northeast'; drop cntyname; format county $mocnty.; label aaa='Area Agency on Aging'; run; proc sort data=georef.aaanames nodupkeys; by aaa; run; proc print data=georef.aaanames; title2 'georef.aaanames'; run; proc print data=georef.aaa_cnty; title2 'georef.aaa_cnty'; run; options mprint; %genfmat(fmatname=aaa,textfile=aaafmat,setin=georef.aaanames,argvars=aaa,labelvar=aaaname,arglen=2,labellen=24); %genfmat(fmatname=cntyaaa,textfile=cntyaaa,setin=georef.aaa_cnty,argvars=fipco,labelvar=aaa,arglen=5,labellen=2); *---test run---; data _null_; set georef.aaa_cnty; alookup=put(fipco,$cntyaaa.); put fipco county aaa aaa $aaa. +1 alookup=; run;