SASUnit Examples  Version 1.5.0
_reportpgmdoc.sas
Go to the documentation of this file.
1 
6 %macro _reportpgmdoc (i_language=);
7 
8  %local l_anzMacros i l_Path l_outputPath l_macroName;
9 
10  %if (%sysfunc(exist (WORK._bugdoc))) %then %do;
11  proc delete data=WORK._bugdoc;
12  run;
13  %end;
14  %if (%sysfunc(exist (WORK._testdoc))) %then %do;
15  proc delete data=WORK._testdoc;
16  run;
17  %end;
18  %if (%sysfunc(exist (WORK._tododoc))) %then %do;
19  proc delete data=WORK._tododoc;
20  run;
21  %end;
22 
23  %_reportCreateStyle;
24 
25  proc format lib=work;
26  value $HeaderText_de
27  "\brief" = "Ausführliche Beschreibung"
28  "\details" = "Ausführliche Beschreibung"
29  "\author" = "Autor"
30  "\date" = "Datum"
31  "\sa" = "Siehe auch"
32  "\bug" = "Fehler"
33  "\test" = "Austehende Tests"
34  "\todo" = "Austehende Aufgaben"
35  "\version" = "Version"
36  "\param" = "Parameter"
37  "\return" = "Rückgabe"
38  "\ret_val" = "Rückgabewert"
39  "\remark" = "Kommentar"
40  "\copyright" = "Copyright"
41  "_label_todolist_" = "Austehende Aufgaben"
42  "_label_testlist_" = "Austehende Tests"
43  "_label_buglist_" = "Fehlerliste"
44  ;
45  value $HeaderText_en
46  "\brief" = "Detailed Description"
47  "\details" = "Detailed Description"
48  "\author" = "Author"
49  "\date" = "Date"
50  "\sa" = "See also"
51  "\bug" = "Bug"
52  "\test" = "Test"
53  "\todo" = "To Do"
54  "\version" = "Version"
55  "\param" = "Parameters"
56  "\return" = "Return"
57  "\ret_val" = "Return value"
58  "\remark" = "Comment"
59  "\copyright" = "Copyright"
60  "_label_todolist_" = "To Do list"
61  "_label_testlist_" = "Test list"
62  "_label_buglist_" = "Bug list"
63  ;
64  value $TagSort
65  "\brief" = "000"
66  "\details" = "000"
67  "\author" = "002"
68  "\date" = "003"
69  "\sa" = "004"
70  "\bug" = "005"
71  "\test" = "006"
72  "\todo" = "007"
73  "\version" = "001"
74  "\param" = "011"
75  "\ret_val" = "012"
76  "\return" = "009"
77  "\remark" = "008"
78  "\copyright" = "00A"
79  ;
80  run;
81 
82  %*** Get all macros to be documented ***;
83  %_dir(
84  i_path=&g_sasunit.
85  ,i_recursive=0
86  ,o_out=work.macros0
87  );
88  data &syslast;
89  length pgm_path $400;
90  set &syslast.;
91  pgm_path="&g_sasunit.";
92  run;
93  %do i=1 %to 9;
94  %if ("&&g_sasautos&i." ne "") %then %do;
95  %_dir(
96  i_path=&&g_sasautos&i.
97  ,i_recursive=0
98  ,o_out=work.macros&i.
99  );
100  data &syslast;
101  length pgm_path $400;
102  set &syslast.;
103  pgm_path="&&g_sasautos&i.";
104  run;
105  %end;
106  %end;
107  data work.macros;
108  set work.macros0
109  %do i=1 %to 9;
110  %if ("%cmpres(&&g_sasautos&i.)" ne "") %then %do;
111  work.macros&i.
112  %end;
113  %end;
114  ;
115  MacroName = resolve ('%_stdpath(' !! trim(pgm_path) !! ',' !! trim(filename) !! ')');
116  run;
117 
118  proc sql noprint;
119  select count (*) into :l_anzMacros from work.macros;
120  quit;
121 
122  %do i=1 %to &l_anzMacros.;
123  %local l_macroPath&i. l_macroName&i.;
124  %end;
125 
126  proc sql noprint;
127  select pgm_path into :l_macroPath1-:l_macroPath%cmpres(&l_anzMacros.) from work.macros;
128  select MacroName into :l_macroName1-:l_macroName%cmpres(&l_anzMacros.) from work.macros;
129  quit;
130 
131  options nocenter;
132 
133  %let l_outputPath = %_abspath(&g_root.,&g_target.)/rep;
134 
135  %do i=1 %to &l_anzMacros;
136 
137  %_scanHeader (MacroName = &&l_macroName&i..
138  ,FilePath = &&l_macroPath&i..
139  ,LiboutDoc = WORK
140  ,DataOutDoc = _Pgm&i.
141  ,i_language = &i_language.
142  );
143 
144  data work._pgmsrc&i.;
145  length Text $400 CommentOpen idxCommentOpen idxCommentClose 8;
146  retain CommentOpen 0;
147  infile "&&l_macroPath&i../&&l_macroName&i..";
148  input;
149  Text=_INFILE_;
150  idxCommentOpen=index (Text, '');
159  if (idxCommentClose > 0) then do;
160  CommentOpen=0;
161  end;
162  keep Text;
163  run;
164 
165  title j=c "Program Documentation for Macro &&l_macroName&i..";
166 
167  ods html4 file="&l_outputPath./pgm_%scan(&&l_macroName&i..,1,%str(.)).html" style=styles.sasunit stylesheet=(url="css/SAS_SASUnit.css");
168  %_reportPgmHeader (i_lib=WORK, i_data=_Pgm&i., i_language=&i_language.);
169 
170  title j=c "Source Code Documentation for Macro &&l_macroName&i..";
171 
172  proc report data=work._pgmsrc&i. nowd missing
173  style(report)=blindTable
174  style(column)=blindFixedFontData
175  style(header)=blindHeader
176  style(lines)=blindCaption [textalign=left]
177  ;
178 
179  column Text;
180 
181  define Text / " ";
182  run;
183 
184  %_closeHtmlPage;
185 
186  %end;
187 
188  ods html4 file="&l_outputPath./__PgmDoc_Lists.html" style=styles.sasunit stylesheet=(url="css/SAS_SASUnit.css");
189 
190  %PrintDocList(lib=WORK, data=_ToDoDoc, title=%sysfunc (putc (_label_todolist_, $Headertext_&i_language..)));
191  %PrintDocList(lib=WORK, data=_TestDoc, title=%sysfunc (putc (_label_testlist_, $Headertext_&i_language..)));
192  %PrintDocList(lib=WORK, data=_BugDoc, title=%sysfunc (putc (_label_buglist_, $Headertext_&i_language..)));
193 
194  ods _all_ close;
195 
196  options center;
197 %mend;
198 
199 %macro PrintDocList (lib=, data=, title=);
200  title "Listen für das Reporting";
201  title2 "&title.";
202  proc sort data=&lib..&data.;
203  by macroname obs_sort;
204  run;
205  proc report data=&lib..&data. nowd missing
206  style(header)=blindHeader
207  style(lines)=blindCaption [textalign=left]
208  ;
209 
210  column macroname dummy obs_sort new_description;
211 
212  define macroname / group noprint;
213  define obs_sort / group noprint;
214  define dummy / display style(column)=blinddata;
215  define new_description / display;
216 
217  compute before macroname;
218  line macroname $80.;
219  endcomp;
220  compute after macroname;
221  line "^_^_^_^_";
222  endcomp;
223  run;
224 %mend;