Thank you Cynthia. I appreciate your help.
I modified by moving the ODS PDF opening and closing statements. I also ADDED and additional ODS PDF Startpage= statement just before the PROC REPORT with a couple of text lines as you suggested.
%macro pdf5(c3,yr,year); proc sql noprint;select distinct cr3 into :cclist separated by ' ' from dat.xyz where cr3 in ("&c3");
%let n_cclist= &sqlobs; quit; %put &cclist;
ODS LISTING close; ods escapechar='^'; ods pdf file="H:\............\&c3._&yr..pdf" startpage=yes;
%let j=1; %let cc=%scan(&cclist,&j,%str( )); %do %while(%scan(&cclist,&j,%STR( )) NE );
options missing='' nodate nonumber orientation=portrait ; /*ODS LISTING close;*/ /*ods pdf file="H:\Shared\MDSEIMB\SFDS\SDS\Green Book\PDF\&cc._&yr..pdf" startpage=yes;*/
proc sql noprint;select distinct Varname1......., ......., etc......., Varname10 into :vxlist separated by ' ', (lists 1 to 10. etc) :c3list separated by ' ' from dat.skinnyxy where crop3="&cc" order by varname1, mm;
%let n_vxlist= &sqlobs; quit;
%let v=1; %let vx=%scan(&vxlist,&v.,%str( ));
.. (List of counter vars 1-10 ect)
.. %let y=1; %let c3=%scan(&c3list,&y.,%str( ));
%do %while(%scan(&vxlist,&v,%STR( )) NE ); ods pdf startpage=no; ods pdf text='^n^n'; ods pdf text="^S={outputwidth=100% just=c} &mh &c2 &year";
proc report nowindows data=pdfd.&sv._&vx._&yr.&mx. SPLIT='*' ls=120 style(report)={rules=none frame=void cellspacing=0 cellpadding=3 borderwidth=0.3 borderleftwidth=0.3 borderrightwidth=0.3 } style(column)={cellheight=0.175in font_face=Arial font_size=0.5 } style(header)={font_face=Arial cellheight=0.40in font_size=0.5 bordertopcolor=black borderbottomcolor=black borderbottomwidth=0.3 backgroundcolor=white }; title1 height=12pt justify=center font=Arial bold &c2;/*Commodity name*/ /*title2 height=1 justify=center font=Arial " &year. J";*/
columns _var1-_varxx (list the variables in the table); define _var1 / ' State' left style(column)={cellwidth=0.5in borderrightcolor=black borderrightwidth=0.3 indent=6}; define var2 / style(column)={cellwidth=0.5in} display format=comma4.1 'Var description' right ; etc
etc
(Define each variable name as you want it listed in the table.)
etc define varxx / display format=comma. 'varxx description' right style(column)={cellwidth=0.6in borderrightcolor=black};
run;
%let v=%eval(&v+1); %let vx=%scan(&vxlist,&v.,%str( )); etc
(List if counting variables)
etc %let y=%eval(&y+1); %let c3=%scan(&c3list,&y.,%str( ));
%end;
%let j=%eval(&j+1); %let cc=%qscan(&cclist,&j.,%str( )); %end; ODS _ALL_ CLOSE; ODS LISTING;
%mend;
/*https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-PDF-Proc-Report-Spanrows-and-Row-height/td-p/117855*/
... View more