#!/bin/bash
#<pre><b>
# Script     : crtitlestmpl
# Version    : 1.3
# Author     : Roland Rashleigh-Berry
# Date       : 20-Jul-2007
# Purpose    : Production script to create file "titles.template" in the study
#              programs directory.
# SubScripts : getfields
# Notes      : none
# Usage      : crtitlestmpl  
#===============================================================================
# PARAMETERS:
#-pos- -------------------------------description-------------------------------
# N/A  Do not supply any parameters
#===============================================================================
# AMENDMENT HISTORY:
# init --date-- mod-id ----------------------description------------------------
# rrb  22Feb07         Use fields 7, 8 and 9
# rrb  25Feb07         Add fields 5 and 6
# rrb  04Mar07         "getfields" script used
# rrb  20Jul07         Mention "label:" and "lisfile:" in the generated header
#===============================================================================
# This is public domain software. No guarantee as to suitability or accuracy is
# given or implied. User uses this code entirely at their own risk.
#===============================================================================

# No parameters allowed
if [ $# -gt 0 ] ; then
  echo "Error: (crtitlestmpl) Do not supply any parameters" 1>&2
  exit 1
fi


# strip out information returned by the "getfields" script
client=$(getfields | cut -d/ -f1)
office=$(getfields | cut -d/ -f2)
drug=$(getfields | cut -d/ -f3)
study=$(getfields | cut -d/ -f4)
inc=$(getfields | cut -d/ -f5)


# format today's date in DD-Mon-YYYY form
date=$(date '+%d-%b-%Y')


cat > titles.template << -----FINISH-----
#===========================================================================================================================================
# Template for titles.      Make a copy of this to go with your sas program and give it the file extension .titles such as t_meds.titles
#                           You must only have ONE set of titles in this file.
#
# This member was generated by the script "crtitlestmpl" for:
#
# CLIENT: $client
# OFFICE: $office
# DRUG: $drug
# STUDY: $study
# INC: $inc
#
# DATE: $date
#
#===================== THE LINES BELOW THAT START WITH A # ARE A GUIDE TO TELL YOU HOW TO FILL IN THE INFORMATION ==========================
#
# program: progname (put your program name here without the .sas extension. Case should match your program member name)
#
# label:  For multiple outputs from the same program then up to a 2 character label can be used to distinguish
#         the different sets of tables and footnotes.
#
# lisfile: The lisfile name is internally generated using program||".lis"||label but you can override it with this.
#          It is subject to strict checking. You must use .lis or .lisx (where "x" is the label you have given)
#          and the first part of the filename can not be an existing program.
#
# layout: Leave blank to use study default or set it to l/p (landscape/portrait) [t] (tight lines) f (font size)
#         Here is a list of valid possible values: l8 l8.5 l9 l10 lt8 lt8.5 lt9 lt10 p8 pc8 p9 pt9 p10 pt10 p11 pt11
#         The preference is for p10 (portrait 10 point). If your report will not fit on the page then try l10 (landscape 10 point)
#         but if it still will not fit then try l9 and if it still will not fit then try l8. You should not go lower than an 8 point
#         font without asking for permission to do so.
#
# population: FAS, PPS, SEL etc. abbreviations. This must match one of the analysis set abbreviations in "protocol.txt".
#
# sascode: If you set this to anything, the sas program will be generated and any corresponding program you have will be overwritten.
#
# titles below: Put your titles BELOW this line. All titles will be CENTRED unless you start with a space in which case LEFT-ALIGNED.
# Table 1.2.3
# ANOTHER TITLE LINE
#  A LEFT-ALIGNED TITLE - THE FIRST SPACE WILL BE DROPPED WHEN IT IS LEFT-ALIGNED BUT EXTRA SPACES WILL BE SHOWN
# footnotes below: Put your footnotes BELOW this line. All footnotes will be LEFT-ALIGNED. Leading spaces are allowed.
# First footnote
# Second footnote
#   Third footnote indented two spaces
#
# endxxx: This line ends the titles entry. Do not specify anything after it.
#===========================================================================================================================================
program: 
layout: 
population: 
sascode: 
#################### Columns ruler for titles and footnotes -- do not exceed the maximum column for your layout ############################
#--------1---------2---------3---------4---------5---------6---------7---------8---------9---------0---------1---------2---------3---------4
titles below:
footnotes below:
endxxx:
#--------1---------2---------3---------4---------5---------6---------7---------8---------9---------0---------1---------2---------3---------4
-----FINISH-----
