Hi Experts, i need help on how i can put tiles on five pairs of tables which are for imports and exports. i posted some questions earlier on but all the answers i received were not applicable. some also wanted to know the code behind so i am posting the code for your review. the program run perfectly but the title code does not work. this is excatly what appears on each of them 'US '||put(&amx,mx1fmt.)||' '||trim(left(put(&amx,mx3fmt.)))|| ' Company Defined '||trim(left(put(ctry_rgn,$rgn2fmt.)))||' - Million US $'; but i need this code to interprete the titles as "US imports from Company Defined Nigeria - Millions US $" for one table and "US Exports from Company Defined Nigeria - Millions US $" and dynamically apply titles to the rest of the tables. %mk_formats; run; %prepdat1; run; %macro driver; data _null_; endhist=&endhist; beghist=intnx('year',endhist, -5);/*5years*/ call symput ('beghist', trim(left(beghist))); run; %let page_count=36; *loop over countries; %do argn=1 %to 5 /*Nigeria, Haiti, Laos, Cuba, Egypt, World*/ %let page_count=%eval(&page_count+1); %do amx=1 %to 2; %let page_count=%eval(&page_count+1); %mk_table1(&argn,&amx); run; %end; %end; %mend driver; *formats; %macro mk_formats; proc format; value mx1fmt 1='Imports' 2='Exports' 4='Imports' 3='Exports' ; proc format; value mx2fmt 1='Import' 2='Export' 4='Import' 3='Export' ; proc format; value mx3fmt 1='from' 2='to' 4='from' 3='to' ; proc format; value rgn1fmt 1='NA' 2='HA' 3='LA' 4='CU' 5='EG' ; proc format; value $rgn2fmt 'NA'='Nigeria' 'HA'='Haiti' 'LA'='Laos' 'CU'='Cuba' 'EG'='Egypt' 'WL'='World' ; %mend mk_formats; *********************************************************************************************; *prepdat4 - data for table1; *********************************************************************************************; %macro prepdat1; data tmp_sum_wtadata(drop= ym); set data.sum_wtadata; if ctry_rgn ne 'WL'; if year(cal) ge year(&endhist)-3; if ym=2; data tmpt(rename = (le=tle y=ty)) tmpa(rename = (le=ale y=ay)) tmpv(rename = (le=vle y=vy)) tmpo(rename = (le=ole y=oy)); set tmp_sum_wtadata; if tvo=1 then output tmpt; if tvo=2 then output tmpa; if tvo=3 then output tmpv; if tvo=4 then output tmpo; proc sort data=tmpt; by ctry_rgn descending mx cal; proc sort data=tmpa; by ctry_rgn descending mx cal; proc sort data=tmpv; by ctry_rgn descending mx cal; data tbl4data(drop=tvo); merge tmpa tmpv tmpt; by ctry_rgn descending mx cal; %mend prepdat1; %macro mk_table1(argn,amx); data tmp; set tbl1data; by ctry_rgn descending mx;/*All imports and exports*/ if mx=&amx; if ctry_rgn=put(&argn,rgn1fmt.); title 'US '||put(&amx,mx1fmt.)||' '||trim(left(put(&amx,mx3fmt.)))|| ' Company Defined '||trim(left(put(ctry_rgn,$rgn2fmt.)))||' - Million US $'; output; %mend mk_table1; %driver;
... View more