Hello Experts,
I don't understand why I have the error in obj.format_text :
I don't think that I need to add a parenthesis to my code.
Maybe this error is linked with the first error (error of file)?
All is seems to be correct in my code :
proc sql noprint;
select count(distinct Code) into :nb_obs_nom_prd from Accord;
quit;
%macro fichiers_publipostage_pdf_accord;
%do i=1 %to &nb_obs_nom_prd.;
data _NULL_;
set ACCORD;
CALL SYMPUTX(COMPRESS('Produit'),Produit);
CALL SYMPUTX(COMPRESS('Code'),Code);
CALL SYMPUTX(COMPRESS('Montant_min_de_vers_init'),Montant_min_de_vers_init);
CALL SYMPUTX(COMPRESS('FRAIS_GESTION_OL_UC2'),FRAIS_GESTION_OL_UC);
run;
OPTION NODATE NONUMBER;
OPTIONS PAPERSIZE=A4;
options orientation=portrait;
OPTIONS TOPMARGIN=.001 in BOTTOMMARGIN=.001 in LEFTMARGIN=.001 in RIGHTMARGIN=.001 in ;
ODS NORESULTS;
ODS PDF FILE = "&Publipostage.\&Code..pdf" dpi=1800;
ODS ESCAPECHAR = "^";
data _NULL_;
declare odsout obj();
obj.layout_absolute(width:
"8.26 in",height:"11.68 in" );
obj.region(width:
"18cm" ,x: "1.5cm", y:"1cm", height:"0.4cm", style_attr: "bordercolor=cx338AF");
obj.line( style_attr: "bordercolor=cx338AFF", size:'0.8mm');
obj.region(width:
" 5 cm",x:"1.5cm", height:"2.2 cm",y:"1.5 cm", style_attr: "bordercolor=cx338AFF bordercolor=cx338AFF");
obj.image(file : "&chemin.\logo_officiel.png" , overrides : " width=100pct ");
obj.region(width:
"8.8 cm",x:"7.5cm", height:"2.7 cm",y:"1.5 cm" ,style_attr: "bordercolor=cx338AFF");
obj.format_text( data: "", overrides: " just=left color=cx95337 font_weight=bold font_size=5pt ");
obj.format_text( data: "Les frais de l'assurance-vie du ", overrides: " just=left color=cx95337 font_weight=bold font_size=16pt ");
obj.format_text( data: "", overrides: " just=left color=cx95337 font_weight=bold font_size=10pt ");
obj.format_text( data: "&Produit.", overrides: " just=left color=cx95337 font_weight=bold font_size=16pt ");
obj.region(width:
"18cm" ,height:"1 cm", x: "1.5cm", y:"3.4 cm", style_attr: "");
obj.line(style_attr: "bordercolor=cx338AFF", size:'0.8mm');
obj.region(width:
"18cm" ,height:"20 cm", x: "1.5cm", y:"4.2 cm", style_attr: "");
obj.format_text( data: "Montant minimal de versement initial : &Montant_min_de_vers_init. ", overrides: "just=left color=cx95337 font_weight=normal font_size=12pt");
obj.format_text( data: "Frais d'adhésion à l'association ayant souscrit le contrat ", overrides: "just=left color=cx95337 font_weight=normal font_size=14pt");
obj.format_text( data: "", overrides: " just=left color=cx95337 font_weight=normal font_size=12pt");
obj.format_text( data: "Frais annuels ", overrides: " just=left color=cx95337 font_weight=bold font_size=12pt");
obj.format_text( data: "", overrides: " just=left color=cx95337 font_weight=normal font_size=12pt");
run;
%end;
%mend;
%fichiers_publipostage_pdf_accord;
Thank you for your help !
Did you have code that worked before writing that macro?
That is the first step, have working non-macro code.
To debug macro errors turn on Options mprint; before running the macro. The log will have more details of the created code and you can read that and the errors should appear closer to the cause in the code.
Note that the path error for your image file is using a relative location, not starting at a drive, so assumes the file path starts in the SAS executable location. Always reference external file locations starting at the drive and include the full path.
Copy text from the log, on the forum open a text box using the </> icon, and paste the text. It is much easier to make suggestions or point out things with TEXT not pictures.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.