SASUnit Examples  Version 1.5.0
_reportscnhtml.sas
Go to the documentation of this file.
1 
24 %MACRO _reportScnHTML (i_repdata =
25  ,o_html = 0
26  ,o_pdf = 0
27  ,o_rtf = 0
28  ,o_path =
29  ,o_file =
30  );
31 
32  %local l_title l_footnote;
33 
34  DATA work._scenario_report;
35  SET &i_repdata;
36  by scn_id;
37 
38  LENGTH abs_path scn_pgm $256
39  LinkColumn1 LinkTitle1 LinkColumn2 LinkTitle2 LinkColumn3 LinkTitle3 /*LinkColumn4 LinkColumn5 LinkColumn6*/ $1000
40  idColumn $80
41  descriptionColumn $1000
42  programColumn $1000
43  last_runColumn $1000
44  durationColumn $1000
45  resultColumn $1000;
46  ;
47  label idColumn="&g_nls_reportScn_003."
48  descriptionColumn="&g_nls_reportScn_004."
49  programColumn="&g_nls_reportScn_005."
50  last_runColumn="&g_nls_reportScn_006."
51  durationColumn="&g_nls_reportScn_007."
52  resultColumn="&g_nls_reportScn_008."
53  ;
54 
55  abs_path = resolve ('%_abspath(&g_root,' !! trim(scn_path) !! ')');
56  scn_pgm = resolve ('%_stdpath(&g_root./saspgm/test,' !! trim(abs_path) !! ')');
57  duration = put (scn_end - scn_start, ??&g_nls_reportScn_013.) !! " s";
58  c_scnid = put (scn_id, z3.);
59 
60 
61  %_render_IdColumn (i_sourceColumn=scn_id
62  ,i_format=z3.
63  ,o_targetColumn=idColumn
64  );
65  %_render_DataColumn (i_sourceColumn=duration
66  ,o_targetColumn=durationColumn
67  );
68  %_render_IconColumn (i_sourceColumn=scn_res
69  ,o_html=&o_html.
70  ,o_targetColumn=resultColumn
71  );
72 
73  *** Any destination that renders links shares this if-clause ***;
74  %if (&o_html. OR &o_pdf. OR &o_rtf.) %then %do;
75  LinkTitle1 = "&g_nls_reportScn_009 " !! c_scnid;
76  LinkTitle2 = "&g_nls_reportScn_010" !! byte(13) !! abs_path;
77  LinkTitle3 = "&g_nls_reportScn_011";
78  *** HTML-links are destinations specific ***;
79  %if (&o_html.) %then %do;
80  LinkColumn1 = catt ("cas_overview.html#SCN", c_scnid, "_");
81  LinkColumn2 = "file:///" !! abs_path;
82  LinkColumn3 = c_scnid !! "_log.html";
83  %end;
84  *** PDF- and RTF-links are not destination specific ***;
85  %if (&o_pdf. OR &o_rtf.) %then %do;
86  LinkColumn1 = catt ("SCN", c_scnid, "_");
87  LinkColumn2 = "pgm_" !! scn_pgm !! "_";
88  LinkColumn3 = c_scnid !! "_log";
89  %end;
90  %_render_DataColumn (i_sourceColumn=scn_desc
91  ,i_linkColumn=LinkColumn1
92  ,i_linkTitle=LinkTitle1
93  ,o_targetColumn=descriptionColumn
94  );
95  %_render_DataColumn (i_sourceColumn=scn_path
96  ,i_linkColumn=LinkColumn2
97  ,i_linkTitle=LinkTitle2
98  ,o_targetColumn=programColumn
99  );
100  %_render_DataColumn (i_sourceColumn=scn_start
101  ,i_format=&g_nls_reportScn_012.
102  ,i_linkColumn=LinkColumn3
103  ,i_linkTitle=LinkTitle3
104  ,o_targetColumn=last_runColumn
105  );
106  %end;
107  if (first.scn_id);
108  RUN;
109 
110  %let l_title=%str(&g_nls_reportScn_001 | &g_project - &g_nls_reportScn_002);
111  title j=c "&l_title.";
112 
113  %_reportFooter(o_html=&o_html);
114 
115  options nocenter;
116 
117  %if (&o_html.) %then %do;
118  ods html4 file="&o_path./&o_file..html"
119  (TITLE="&l_title.")
120  /* Order of .js files in headtext attribute is essential */
121  headtext='<script src="js/jquery.min.and.tablesorter.min.js"></script><link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />'
122  metatext="http-equiv=""Content-Style-Type"" content=""text/css"" /><meta http-equiv=""Content-Language"" content=""&i_language."" /"
123  style=styles.SASUnit stylesheet=(URL="css/SAS_SASUnit.css")
124  encoding="&g_rep_encoding.";
125  %_reportPageTopHTML(
126  i_title = &l_title.
127  ,i_current = 2
128  )
129  %end;
130  %if (&o_pdf.) %then %do;
131  ods pdf file="&o_path./&o_file..pdf" style=styles.SASUnit cssstyle="&g_target./SAS_SASUnit.css";
132  %end;
133  %if (&o_rtf.) %then %do;
134  ods rtf file="&o_path./&o_file..rtf" style=styles.SASUnit cssstyle="&g_target./SAS_SASUnit.css";
135  %end;
136 
137  proc print data=work._scenario_report noobs label;
138  var idColumn / style(column)=rowheader;
139  var descriptionColumn
140  programColumn
141  last_runColumn;
142  var durationColumn / style(column)=[just=right];
143  var resultColumn / style(column)=[background=white];
144  run;
145 
146  %if (&o_html.) %then %do;
147  %_closeHtmlPage;
148  %end;
149  %if (&o_pdf.) %then %do;
150  ods pdf close;
151  %end;
152  %if (&o_rtf.) %then %do;
153  ods rtf close;
154  %end;
155 
156  %*** Reset title and footnotes ***;
157  title;
158  footnote;
159 
160  options center;
161 
162  PROC DATASETS NOWARN NOLIST LIB=work;
163  DELETE _scenario_report;
164  QUIT;
165 %MEND _reportScnHTML;