Published on :
Macro / Documentation INTERNAL_CREATION

Code Diary Documentation Generation and HTML Conversion

This code is also available in: Deutsch Español Français
Awaiting validation
This program initializes the environment by including specific macros (`code_diary`, `convert_markdown_to_html`). It then defines, via DATA steps and `datalines`, configuration tables to manage aliases, section order, headers, and 'scrub' rules. Finally, it executes the `%code_diary` macro to produce a Markdown file from a SAS© project, followed by the `%convert_markdown_to_html` macro to produce the final render in HTML format.
Data Analysis

Type : INTERNAL_CREATION


The data used (alias_list, order_list, header_list, scrub_list) are parameter tables created directly within the script via `datalines`.

1 Code Block
MACRO CALL
Explanation :
Inclusion of external macro definitions required for processing from the directory pointed to by the macro variable `&MACRO_ROOT`.
Copied!
1%include "&MACRO_ROOT.code_diary.sas";
2%include "&MACRO_ROOT.convert_markdown_to_html.sas";
3 
2 Code Block
DATA STEP Data
Explanation :
Creation of four temporary SAS tables (`alias_list`, `order_list`, `header_list`, `scrub_list`) using `datalines`. These tables contain the configuration parameters for the documentation macro (keyword mapping, display order, header labels, elements to hide).
Copied!
1DATA work.alias_list;
2 INFILE DATALINES;
3 INPUT short_keyword $1-10 long_keyword $11-50;
4 DATALINES;
5excl exclusion
6stat statistics
7;
8 
9DATA work.order_list;
10 INFILE DATALINES;
11 INPUT keyword $1-20 order_no 21-25;
12 DATALINES;
13todo -30
14exclusion -20
15exclusion.time -19
16exclusion.person -18
17methods -10
18no_keyword 0
19;
20 
21DATA work.header_list;
22 INFILE DATALINES;
23 INPUT keyword $1-15 header $16-50;
24 DATALINES;
25exclusion Exclusion criteria
26person Subjects
27time Time periods
28todo Task list
29;
30 
31DATA work.scrub_list;
32 INFILE DATALINES;
33 INPUT keyword $1-15;
34 DATALINES;
35todo
36regex
37;
3 Code Block
MACRO CALL
Explanation :
Call to the `%code_diary` macro to analyze the `project_main.sas` file. It uses the previously created configuration tables to structure and filter the content, generating two Markdown files as output.
Copied!
1%code_diary(
2 input_main_file = &DEMO_ROOT.project_main.sas,
3 out_dir = &DEMO_ROOT,
4 out_file = OUTPUT-coder.md,
5 out_file_scrubbed = OUTPUT-for-all.md,
6 debug_mode = 0,
7 section_aliases = work.alias_list,
8 section_order = work.order_list,
9 section_headers = work.header_list,
10 sections_scrubbed = work.scrub_list
11);
4 Code Block
MACRO CALL
Explanation :
Call to the `%convert_markdown_to_html` macro to convert the generated Markdown file (`output-for-all.md`) into an HTML page (`output-for-all.htm`).
Copied!
1%convert_markdown_to_html(
2 in_file_md = "&DEMO_ROOT.output-for-all.md",
3 out_file_html = "&DEMO_ROOT.output-for-all.htm",
4 debug_mode = 0
5);
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.