Post-Processing.LST files to get what you want

Similar documents
PCGenesis User Interface Procedures

Run your reports through that last loop to standardize the presentation attributes

The Dataset Diet How to transform short and fat into long and thin

HTML for the SAS Programmer

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

ODS/RTF Pagination Revisit

PDF Multi-Level Bookmarks via SAS

Figure 1. Table shell

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

Exporting Variable Labels as Column Headers in Excel using SAS Chaitanya Chowdagam, MaxisIT Inc., Metuchen, NJ

shaping covering with chocolate Macro Cookbook for Microsoft Word sweet, sweet success! testing Jack Lyon

Making an RTF file Out of a Text File, With SAS Paper CC13

Computing Environments: NT 4.0 SAS Products: PC SAS 6.12 Other software products: Microsoft Word 97

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE

Have SAS Annotate your Blank CRF for you! Plus dynamically add color and style to your annotations. Steven Black, Agility-Clinical Inc.

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

%ANYTL: A Versatile Table/Listing Macro

PharmaSUG China 2018 Paper AD-62

Ditch the Data Memo: Using Macro Variables and Outer Union Corresponding in PROC SQL to Create Data Set Summary Tables Andrea Shane MDRC, Oakland, CA

A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files

It s Proc Tabulate Jim, but not as we know it!

SAS Drug Development Program Portability

Reading in Data Directly from Microsoft Word Questionnaire Forms

Multiple Graphical and Tabular Reports on One Page, Multiple Ways to Do It Niraj J Pandya, CT, USA

Paper PO07. %RiTEN. Duong Tran, Independent Consultant, London, Great Britain

A Macro to replace PROC REPORT!?

The Output Bundle: A Solution for a Fully Documented Program Run

Statistics without DATA _NULLS_

Creating Forest Plots Using SAS/GRAPH and the Annotate Facility

ABSTRACT: INTRODUCTION: WEB CRAWLER OVERVIEW: METHOD 1: WEB CRAWLER IN SAS DATA STEP CODE. Paper CC-17

Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas

SAS Online Training: Course contents: Agenda:

Quick Results with the Output Delivery System

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

There s No Such Thing as Normal Clinical Trials Data, or Is There? Daphne Ewing, Octagon Research Solutions, Inc., Wayne, PA

How to Keep Multiple Formats in One Variable after Transpose Mindy Wang

3N Validation to Validate PROC COMPARE Output

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

Using Graph-N-Go With ODS to Easily Present Your Data and Web-Enable Your Graphs Curtis A. Smith, Defense Contract Audit Agency, La Mirada, CA

ABSTRACT INTRODUCTION TRICK 1: CHOOSE THE BEST METHOD TO CREATE MACRO VARIABLES

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

Professional outputs with ODS LATEX

Essential ODS Techniques for Creating Reports in PDF Patrick Thornton, SRI International, Menlo Park, CA

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands

Presentation Quality Bulleted Lists Using ODS in SAS 9.2. Karl M. Kilgore, PhD, Cetus Group, LLC, Timonium, MD

The Power of Combining Data with the PROC SQL

Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA

Producing Summary Tables in SAS Enterprise Guide

Clinical Data Visualization using TIBCO Spotfire and SAS

Using Templates Created by the SAS/STAT Procedures

Paper Phil Mason, Wood Street Consultants

Taming the Box Plot. Sanjiv Ramalingam, Octagon Research Solutions, Inc., Wayne, PA

Creating output datasets using SQL (Structured Query Language) only Andrii Stakhniv, Experis Clinical, Ukraine

One SAS To Rule Them All

A Breeze through SAS options to Enter a Zero-filled row Kajal Tahiliani, ICON Clinical Research, Warrington, PA

Program Validation: Logging the Log

A Fully Automated Approach to Concatenate RTF outputs and Create TOC Zhiping Yan, Covance, Beijing, China Lugang Xie, Merck, Princeton, US

PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets

A Mass Symphony: Directing the Program Logs, Lists, and Outputs

PharmaSUG Paper SP09

LST in Comparison Sanket Kale, Parexel International Inc., Durham, NC Sajin Johnny, Parexel International Inc., Durham, NC

EXPORTING SAS OUTPUT ONTO THE WORLD WIDE WEB

RICH ENTERPRISES. Small Business Series. Getting Started with HTML

SAS CLINICAL SYLLABUS. DURATION: - 60 Hours

SESUG Paper RIV An Obvious Yet Helpful Guide to Developing Recurring Reports in SAS. Rachel Straney, University of Central Florida

Liberate, a component-based service orientated reporting architecture

Advanced Visualization using TIBCO Spotfire and SAS

PharmaSUG Paper PO12

Data Manipulation with SQL Mara Werner, HHS/OIG, Chicago, IL

Accessibility 101. Things to Consider. Text Documents & Presentations: Word, PDF, PowerPoint, Excel, and General D2L Accessibility Guidelines.

Developing Graphical Standards: A Collaborative, Cross-Functional Approach Mayur Uttarwar, Seattle Genetics, Inc., Bothell, WA

How to Create Sub-sub Headings in PROC REPORT and Why You Might Want to: Thinking about Non-traditional Uses of PROC REPORT

ODS TAGSETS - a Powerful Reporting Method

A Dynamic Imagemap Generator Carol Martell, Highway Safety Research Center, Chapel Hill, NC

%Addval: A SAS Macro Which Completes the Cartesian Product of Dataset Observations for All Values of a Selected Set of Variables

SAS 9 Programming Enhancements Marje Fecht, Prowerk Consulting Ltd Mississauga, Ontario, Canada

A Macro to Create Program Inventory for Analysis Data Reviewer s Guide Xianhua (Allen) Zeng, PAREXEL International, Shanghai, China

IT S THE LINES PER PAGE THAT COUNTS Jonathan Squire, C2RA, Cambridge, MA Johnny Tai, Comsys, Portage, MI

PharmaSUG 2017 Paper BB02

Your Own SAS Macros Are as Powerful as You Are Ingenious

Streamline Table Lookup by Embedding HASH in FCMP Qing Liu, Eli Lilly & Company, Shanghai, China

Give me EVERYTHING! A macro to combine the CONTENTS procedure output and formats. Lynn Mullins, PPD, Cincinnati, Ohio

Validation Summary using SYSINFO

Customising SAS OQ to Provide Business Specific Testing of SAS Installations and Updates

Uncommon Techniques for Common Variables

1. Please, please, please look at the style sheets job aid that I sent to you some time ago in conjunction with this document.

A Novel Approach to Patient Profiling

Paper # Jazz it up a Little with Formats. Brian Bee, The Knowledge Warehouse Ltd

General Methods to Use Special Characters Dennis Gianneschi, Amgen Inc., Thousand Oaks, CA

PharmaSUG China Paper 059

The Submission Data File System Automating the Creation of CDISC SDTM and ADaM Datasets

PharmaSUG Paper TT11

The Benefits of Traceability Beyond Just From SDTM to ADaM in CDISC Standards Maggie Ci Jiang, Teva Pharmaceuticals, Great Valley, PA

SAS Viya 3.1 FAQ for Processing UTF-8 Data

From Manual to Automatic with Overdrive - Using SAS to Automate Report Generation Faron Kincheloe, Baylor University, Waco, TX

An Easy Route to a Missing Data Report with ODS+PROC FREQ+A Data Step Mike Zdeb, FSL, University at Albany School of Public Health, Rensselaer, NY

A Macro to Keep Titles and Footnotes in One Place

ABBYY FineReader 14. User s Guide ABBYY Production LLC. All rights reserved.

Transcription:

Paper CC04 Post-Processing.LST files to get what you want Edward Foster, Oxford Pharmaceutical Sciences, UK ABSTRACT SAS has a range of procedures you can use to create table and listing output. These range from the simple PROC PRINT to more advanced reporting procedures such as PROC REPORT and PROC TABULATE. If we want the highest level of control we can even produce output using a DATA _NULL_ step. Even with this array of reporting options sometimes you cannot always produce what you want using these standard methods. This paper will outline a number of methods using SAS and MS Word to get the results you require. INTRODUCTION Since the introduction of ODS in version 8 a large part of the focus in report production has fallen on how this SAS technology can be used to produce clinical trial report output. However a large part of the output created by pharmaceutical companies and CROs still takes the form of ASCII files created from SAS using PROC PRINTTO statements. These files are typically denoted with the standard SAS.LST file extension; though of course this can be any file extension (.TXT is another popular option). The SAS output procedures such as PROC REPORT or PROC TABULATE are used extensively to produce SAS output because most of the time the required results can be obtained by harnessing these procedures with the correct reporting options. However it is not always easy to produce exactly what you want through these procedures. Sometimes even simple requirements require a bit of effort on the part of the programmer. Sometimes all we need is a page number. Sometimes we need to format the text differently. Whatever it is we need there are a few simple techniques that we can employ to really get what we want. The first technique is to post-process the output file from within SAS. This is a good option for a couple of reasons. Firstly the post-processing process can be part of the program that creates the output. This is an advantage because the process can firstly be audited through the SAS log. Secondly creation and formatting of the output remains with the SAS programmer which means that the entire output production process in one package (namely the SAS program). The second technique is postprocessing in MS Word. Importing SAS output into MS Word is a common practice in the complication of study output into a distributable package. Even if MS Word is not the final destination of the SAS output (conversion to PDF is common) it is often used as a method to firstly format (bold text etc) the output into the required state. The reason for this is because MS Word can be automated using macro code written in VBA (Visual Basic for Applications). With VBA it becomes possible to format the report in ways that are not possible with an ASCII file. For example, an ASCII file has no notion of bolded text or any other text formatting (like fonts etc). From MS Word it is possible to apply all these to the output and in an automatic way. A key component of post processing output is the use of tags. In many cases implementing post processing techniques is not possible without these. USING TAGS Tags are best described as place-holders or markers that in this context are used to show the post-processing program what needs to be formatted and how. The use of tags is widespread across the programming world. Perhaps the most widely used set of tags in the world is the HTML markup language. By using HTML tags it is possible to format the content of web pages with the browser. For example to make a piece of text bold in a browser window we can mark it up using the <b> and </b> tags at either end of the text in question. When the browser renders this text it knows to render it as bold but it always removed the tags before displaying the text. In this way the formatting information provided by the tags are invisible to the user. This is the main difference between these tags and many of the tags that we will need to implement to post-process our output because our tags will not be rendered invisible in the file and so in most cases will need to be removed. TECHNIQUE 1 POST-PROCESSING IN SAS One of the most common items that we need on a report is a page number, usually in the Page x of y format. This is not easy to do using the standard report procedures though it can be easier to do with ODS style output using custom style templates. For listing output an option is to implement a DATA _NULL_ step to exactly position all the items on your page. This is the most advanced SAS reporting option and gives you the most control but can be time consuming to implement especially if the 1

report format is complex. Most of the time a better option is to combine the standard reporting procedures with a simpler DATA _NULL_ step. The standard reporting procedure will produce the main portion of the report getting us 90-95% of the way there, with the DATA _NULL_ used to post-process the file to add, delete or format items after the standard reporting procedure has finished. This methodology is much easier and faster to implement than a full DATA _NULL_ report because the formatting of the main sections of the output, such as the table columns and headers, is taken care of by the SAS reporting procedure. The SAS reporting procedure is therefore responsible for quickly routing the output to the output file. Once the procedure has completed this output file can then be imported into back into a SAS dataset using an INFILE statement. Once the file has been reimported into SAS the lines of text that make up the output can be edited. Items such as page numbers can then be added to the report. The edited dataset can then be exported back to the output file using FILE statements. READING OUTPUT BACK INTO SAS The key to post-processing in SAS is accurately importing the output file you have created back into SAS. There are a number of different ways to do this but below is an example of one method: data import; infile "D:\PostProcess\TDemog.lst" length=len; length text $200; input text $varying. len; run; The $VARYING format is useful for importing this type of file as it reads each line using the actual length of each line (supplied by the LEN variable) as a guide for the format. This means that no data should be lost by truncation in the import process. The resulting IMPORT dataset has one line per line of text in the LST file. Once the data has been imported into SAS we can manipulate the formatting of the file through using SAS character functions like SUBSTR or SCAN. SAS EXAMPLE As previously stated the addition of a page number is a very common requirement in the creation of SAS output. Another requirement could be to add a (continued) flag to both the bottom of each page and the end of each report title. The (continued) flag should only appear from page 2 onwards. The output can be found in Appendix 1. Firstly we need to know how many page we have in our output file. Typically either the protocol number or table number of the output is displayed on the first line of an output. In our case it is the protocol number. We can use this to determine when we have entered a new page. We also need to know the maximum width of all the lines in order that we can accurately place the page number of the far right of the report. We could therefore modify the code used to import the LST file to determine the both the number of pages and the width of each line in the same step. data import; infile "D:\PostProcess\TDemog.lst" length=len; length text $200 _page _len 8; retain _page 0; input text $varying. len; _len=len; if index(text, Protocol: xxx123 )>0 then _page+1; run; proc sql noprint; select trim(left(put(max(_len),8.))), trim(left(put(max(_page),8.))) into : maxlen, : maxpage from import ; quit; With both of these pieces of information we can now add the page number where we want. data addpages; set import; by _page; 2

run; ** WORK OUT THE POSITIONING OF THE PAGE NUMBER BY WORKING **; ** OUT THE MAXIMUM WIDTH REQUIRED **; _pagepos = &maxlen-length( Page &maxpage of &maxpage ); _pagetxt= Page trim(left(put(_page,8.))) of &maxpage ; ** ADD THE PAGE NUMBER TO THE OUTPUT **; if first._page then substr(text,_pagepos,length(_pagetxt))=_pagetxt; ** REPLACE LAST LINE WITH (continued) **; _llinepos= index(text, LAST LINE ); if _llinepos>0 AND _page>1 then substr(text, _llinepos, 11)= (continued) ; else if _linepos>0 AND _page=1 then substr(text, _linepos, 9)= (continued) ; ** ADD CONTINUED TO END OF TITLE **; if _page>1 AND index(text, Table 2.1 )>0 then substr(text,_len+2,11)= (continued) ; The (continued) flags are added in a slightly different way. For the (continued) flag at the bottom of the page a tag was used to denote where to place the flag. This flag is the text LAST LINE which is placed by the reporting program as the very last FOOTNOTE in the report. When the post-processing program comes across this tag it knows it needs to replace the tag with (continued) on each page except the first (in which case it just deletes the tag). In the case of the title we used the table number as the tag to place the flag. The final step is to output the dataset back into a LST file. The code below demonstrated how this can be done. The code below actually replaces the original file. This is common practice (but not essential) because the original file format does not need to be kept. data _null_; set addpages; file D:\PostProcess\TDemog.lst ; _newlen=length(text); put text $varying. _newlen; run; This code could be easily converted into a generic macro program that could be used to perform the same task on a number of tables. For example the tag values and file names could be supplied by macro variables instead. TECHNIQUE 2 POST-PROCESSING IN WORD There are occasions where it is not possible to post-process our LST in the way we want with SAS itself. An example of this is where we need to format our LST file with a particular font or bold certain text etc. The reason for this is because the ASCII file that is produced by SAS does not have any concept of any sort of text formatting. This is where MS Word comes in. MS Word can be automated with macros crated using VBA. With these macros it becomes possible to further transform the tables we create. IMPORT INTO WORD As with post processing in SAS the first stage of post-processing in word is to import the LST file. This VBA code will import our file into Word (this file is in Appendix 2) set the font and page orientation: Selection.InsertFile ("D:\PostProcess\TDemog2.lst") With ActiveDocument.PageSetup.LineNumbering.Active = False.Orientation = wdorientlandscape.topmargin = CentimetersToPoints(2.5).BottomMargin = CentimetersToPoints(2.5).LeftMargin = CentimetersToPoints(1.1).RightMargin = CentimetersToPoints(1.1).Gutter = CentimetersToPoints(0).HeaderDistance = CentimetersToPoints(1.25).FooterDistance = CentimetersToPoints(1.25) 3

.PageWidth = CentimetersToPoints(27.94).PageHeight = CentimetersToPoints(21.59).FirstPageTray = wdprinterdefaultbin.otherpagestray = wdprinterdefaultbin.oddandevenpagesheaderfooter = False.DifferentFirstPageHeaderFooter = False.VerticalAlignment = wdalignverticaltop.suppressendnotes = False.MirrorMargins = False.TwoPagesOnOne = False.GutterPos = wdgutterposleft End With Selection.WholeStory Selection.Font.Name = "Courier New" Selection.Font.Size = 8 Once the file has been imported it is now possible to format how we want. In our example we want to perform the listed actions when we find the following tags <BOLDTHISWORD> - Bold the word to the right of the tag <BOLDTHISLINE> - Bold the all the text on the same line to the right of the tag <ITALICLINE> - Convert all the text on the same line to italic To do this we need to hook up the search facility within Word so we can loop through the document searching for each occurrence of the tags. The following code searches for <BOLDTHISWORD>. Section A returns the cursor to the top of the document and then sets the parameters for the search. Section B executes the search. The code within the DO..WHILE loop is executed each time the search returns a successful find of the text. When a tag is found it is first deleted then the next word on the line is selected and formatted as bold. ' SEARCH FOR <BOLDTHISWORD> Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Plain Text") With Selection.Find.Text = "<BOLDTHISWORD>".Replacement.Text = "".Forward = True.Wrap = wdfindcontinue.format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = False End With Do While Selection.Find.Execute = True Selection.Delete Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend Selection.Font.Bold = True Selection.MoveLeft Unit:=wdCharacter, Count:=1 Loop A B This technique can be used to search for any number of tags within the document and execute the formatting code. The Whole macro is found in Appendix 3. CONCLUSION As you can see it can be easy to format LST files the way you require. If it is not possible to get what you want from the standard reporting procedures it is possible to implement a post-processing strategy that will fill the gaps. The two techniques outlined in this paper detail how this can be put into place with SAS or MS Word. We can create very complicated generic formatting programs which can accurately position all sorts of items by the use of a system of consistently used tags. The tags are introduced into the raw output file either prior to reporting within the reporting dataset or are introduced within the reporting procedure itself. By using a set of different tags each with different meanings we 4

are effectively creating markers for the post processing programs to search for and interpret. Developing a library of tags with different but explicit meanings allows a post processing program to create a range of complicated changes to the output file. A consistent application of tags from a tag library across SAS programs means that post processing transformations can be encapsulated within generic SAS or VBA macros. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Edward Foster Oxford Pharmaceutical Sciences Lancaster House Kingston Business Park Kingston Bagpuize Oxford / OX13 5FE Work Phone: +44 (0) 1462 477948 Email: edward.foster@ops-web.com Web: www.ops-web.com SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. indicates USA registration. Other brand and product names are trademarks of their respective companies. 5

APPENDIX 1 Protocol: xxx123 Table 2.1 Demography Characteristics Overall Number(%) of Subjects xxx Age (years): <=1 Year xx (xx.x%) >1 Year - 6 Years xx (xx.x%) >6 Years - 8 Years xx (xx.x%) >8 Years - 12 Years xx (xx.x%) >12 Years - 17 Years xx (xx.x%) >17 Years xx (xx.x%) Mean x.x Range xx-xx Gender: Male xx (xx.x%) Female xx (xx.x%) Total xx (xx.x%) LAST LINE 6

Protocol: xxx123 PhUSE 2006 Table 2.1 Demography Characteristics Overall Number(%) of Subjects xxx Race: White xx (xx.x%) Black xx (xx.x%) Asian xx (xx.x%) Other xx (xx.x%) Weight (kg): Low Weight Group (>x-xxkg) Medium Weight Group (>xx-xxkg) High Weight Group (>xxkg) LAST LINE 7

Protocol: xxx123 PhUSE 2006 Table 2.1 Demography Characteristics Overall Number(%) of Subjects xxx Height (cm): LAST LINE 8

APPENDIX 2 <BOLDTHISWORD>Protocol: xxx123 Page 1 of 3 <BOLDTHISLINE>Table 2.1 Demography Characteristics Overall Number(%) of Subjects xxx <BOLDTHISLINE>Age (years): <=1 Year xx (xx.x%) >1 Year - 6 Years xx (xx.x%) >6 Years - 8 Years xx (xx.x%) >8 Years - 12 Years xx (xx.x%) >12 Years - 17 Years xx (xx.x%) >17 Years xx (xx.x%) Mean x.x Range xx-xx <BOLDTHISLINE>Gender: Male xx (xx.x%) Female xx (xx.x%) Total xx (xx.x%) 9

<BOLDTHISWORD>Protocol: xxx123 Page 2 of 3 <BOLDTHISLINE>Table 2.1 Demography Characteristics (continued) Overall Number(%) of Subjects xxx <BOLDTHISLINE>Race: White xx (xx.x%) Black xx (xx.x%) Asian xx (xx.x%) Other xx (xx.x%) <BOLDTHISLINE>Weight (kg): <ITALICLINE>Low Weight Group (>x-xxkg) <ITALICLINE>Medium Weight Group (>xx-xxkg) <ITALICLINE>High Weight Group (>xxkg) (continued) PhUSE 2006 10

<BOLDTHISWORD>Protocol: xxx123 Page 3 of 3 <BOLDTHISLINE>Table 2.1 Demography Characteristics (continued) PhUSE 2006 Overall Number(%) of Subjects 128 <BOLDTHISLINE>Height (cm): (continued) 11

APPENDIX 3 Sub Formating() ' ' Macro1 Macro ' ' Selection.InsertFile ("C:\Documents and Settings\Edward\My Documents\PhUSE Presentations\PhUSE 2006 (Dublin)\3. Post Processing.LST Files\Code\Tdemog2.lst") With ActiveDocument.PageSetup.LineNumbering.Active = False.Orientation = wdorientlandscape.topmargin = CentimetersToPoints(2.5).BottomMargin = CentimetersToPoints(2.5).LeftMargin = CentimetersToPoints(1.1).RightMargin = CentimetersToPoints(1.1).Gutter = CentimetersToPoints(0).HeaderDistance = CentimetersToPoints(1.25).FooterDistance = CentimetersToPoints(1.25).PageWidth = CentimetersToPoints(27.94).PageHeight = CentimetersToPoints(21.59).FirstPageTray = wdprinterdefaultbin.otherpagestray = wdprinterdefaultbin.oddandevenpagesheaderfooter = False.DifferentFirstPageHeaderFooter = False.VerticalAlignment = wdalignverticaltop.suppressendnotes = False.MirrorMargins = False.TwoPagesOnOne = False.GutterPos = wdgutterposleft End With Selection.WholeStory Selection.Font.Name = "Courier New" Selection.Font.Size = 8 ' SEARCH FOR <BOLDTHISWORD> Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Plain Text") With Selection.Find.Text = "<BOLDTHISWORD>".Replacement.Text = "".Forward = True.Wrap = wdfindcontinue.format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = False End With Do While Selection.Find.Execute = True Selection.Delete Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=wdExtend Selection.Font.Bold = True Selection.MoveLeft Unit:=wdCharacter, Count:=1 12

Loop ' SEARCH FOR <BOLDTHISLINE> Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Plain Text") With Selection.Find.Text = "<BOLDTHISLINE>".Replacement.Text = "".Forward = True.Wrap = wdfindcontinue.format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = False End With Do While Selection.Find.Execute = True Selection.Delete Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Font.Bold = True Selection.MoveLeft Unit:=wdCharacter, Count:=1 Loop ' SEARCH FOR <ITALICLINE> Selection.HomeKey Unit:=wdStory Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Plain Text") With Selection.Find.Text = "<ITALICLINE>".Replacement.Text = "".Forward = True.Wrap = wdfindcontinue.format = False.MatchCase = False.MatchWholeWord = False.MatchWildcards = False.MatchSoundsLike = False.MatchAllWordForms = False End With Do While Selection.Find.Execute = True Selection.Delete Selection.EndKey Unit:=wdLine, Extend:=wdExtend Selection.Font.Italic = True Selection.MoveLeft Unit:=wdCharacter, Count:=1 Loop End Sub 13