* Bonjour, *
J’ai un Beug avec un programme que je n’arrive pas à comprendre. J’espère que vous pourrez m’aider.
J’exécute ce programme pour générer une sortie Excel avec une mise en forme conditionnelle :
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
proc format;
value $remise
"OUI"='lightgreen'
"NON"='lightorange'
"NEA"='lightblue'
" "='lightgrey';
run;
proc template;
define style Styles.synthese;
parent = styles.festival;
REPLACE header /
bordertopcolor = white
font_face = "Verdana"
just = c
vjust = C;
REPLACE DATA FROM COLUMN /
bordertopcolor = CX000000
borderbottomcolor = CX000000
borderrightcolor = CX000000
borderleftcolor =CX000000;
end;
run;
options nocenter nonotes ;
ods listing close;
ODS TAGSETS.EXCELXP
options
(sheet_name='essaie'
embedded_titles='Yes'
absolute_column_width='6,25,6,6,6,6,6'
embedded_footnotes='Yes'
width_fudge='1.05')
path ="&rep.\mise_en_forme"
FILE = "essai.xls"
style=synthese;
title ;
PROC report DATA = test.synthese nowd;
define CIB/ center display style(COLUMN)=[tagattr='format:@' FONT_WEIGHT=BOLD font_face="Verdana"];
define DENOMINATION/ display "DENOMINATION" style(COLUMN)=[ font_face="MS Sans Serif" font_size = 10pt];
define SMF/center display style(COLUMN)=[ font_face="MS Sans Serif" font_size = 10pt];
define M_INTDEPO/ center display style(COLUMN)=[background=$remise. font_face="MS Sans Serif" font_size = 10pt];
define M_INTENCO/ center display style(COLUMN)=[background=$remise. font_face="MS Sans Serif" font_size = 10pt];
define M_INTNOUA/ center display style(COLUMN)=[background=$remise. font_face="MS Sans Serif" font_size = 10pt];
define M_INTNOUG/ center display style(COLUMN)=[background=$remise. font_face="MS Sans Serif" font_size = 10pt];
RUN ;
ODS TAGSETS.EXCELXP CLOSE ; |
Tout se passe bien et j’ai ma sortie EXCEL avec la mise en forme que je souhaite. Là ou ça se complique c’est quand je passe à automatiser le programme :
Code :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
%macro essai;
proc format;
value $remise
"OUI"='lightgreen'
"NON"='lightorange'
"NEA"='lightblue'
" "='lightgrey';
run;
proc template;
define style Styles.synthese;
parent = styles.festival;
REPLACE header /
bordertopcolor = white
font_face = "Verdana"
just = c
vjust = C;
REPLACE DATA FROM COLUMN /
bordertopcolor = CX000000
borderbottomcolor = CX000000
borderrightcolor = CX000000
borderleftcolor =CX000000;
end;
run;
options nocenter nonotes ;
ods listing close;
ODS TAGSETS.EXCELXP
options
(sheet_name="feuille"
embedded_titles='Yes'
absolute_column_width='6,25,6,6,6,6,6,6,6,6,6,6,6,6,6'
embedded_footnotes='Yes'
width_fudge='1.01')
FILE = "&rep./test1.xls"
style=synthese;
title ;
PROC report DATA = S2_SYNTHESE3 nowd;
define CIB/ center display style(COLUMN)=[tagattr='format:@' FONT_WEIGHT=BOLD font_face="Verdana"];
define DENOMINATION/ display "DENOMINATION" style(COLUMN)=[ font_face="MS Sans Serif" font_size = 10pt];
define SMF/center display style(COLUMN)=[ font_face="MS Sans Serif" font_size = 10pt];
%Do nbre_col=1 %TO &nbre_tableau;
define &&tableau&nbre_col. /center display style(COLUMN)=[background=$remise. font_face="MS Sans Serif" font_size = 10pt];
%end;
RUN ;
ODS TAGSETS.EXCELXP CLOSE ;
%mend essai;
%essai; |
Il n’y a aucune erreur dans la log mais quand j’ouvre mon fichier EXCEL voici la surprise :
une fenêtre indique un problème de chargement dans le domaine suivant style
Impossible d'ouvrir ce fichier en raison d'erreurs. les erreurs sont répertoriées dans .........
Après plusieurs essais je sais que le problème vient de style(column)=[background=$remise.]. Car quand je le retire tout se passe bien.
Sans la direction ods tagsets le résultat est bon aussi.
Mais le mélange format+macro+ tagset ne marche pas. Il y a quelque chose qui m’échappe.
D’avance Merci,
Chiraz.