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