I guess most people develop their programs using SAS software interactively these days. Some, like me, have always done their development work in batch. I know habits are hard to break and changing from interactive development to batch development might take a long time, but the way Spectre is designed, it is much quicker to do all your development in batch. This is because there have been a lot of Unix shell scripts written that you will need to use and these are launched from the terminal window.
The final output run will be in batch so, for QC purposes, you should work as closely as possible to that method. In the final output run, each program will be run using the script "sasb" which will give a count of error messages, warning and messages of interest such as zero observations. You will have to check all of these. Details of the messages can be displayed using the script "sc" (short for scan logs). So even if you are editing your program using an interactive SAS session, you should run it from the terminal window using "sasb" and check the log messages using "sc". It should also be noted that in the final run, every program will be run independently using separate invocations of "sasb". This avoids any potential problem of one program affecting another and is the only sure way to know that the program that has passed its QC will work in an identical way for the final run.
prog=t_fpatdem
export prog |
The "export prog" command has only to be done once per terminal window. It "promotes" the variable to being "global" so that other scripts you use can be aware that it is there (it is like declaring a SAS software macro variable as %global).
Once your program name has been assigned to "prog" and exported, then there are other scripts you can use to emulate a SAS interactive session. They call dtpad (or nedit) in either edit mode or browse mode. "pgm" will open up your ".sas" file in edit mode. "log" will open the log in browse mode. "lst" will open the .lst file in browse mode. "lis" will open up your .lis file (".lis" files are explained in another section - they are effectively .lst files with page number added). The abbreviations "pgm", "log" and "lst" are borrowed from interactive SAS sessions. If used on the command line then they will take you to those windows. So what I have done with these scripts is make interactive users of SAS software "feel at home" if they swap over to using batch.
(Note that I have introduced some scripts in the above paragraph. All scripts introduced on a page will be listed at the top of the page. If you look at the top of this page you will see these scripts listed plus some more).
So now we come to creating our changeable titles (and
footnotes). Assuming you are working in batch mode, this is how to set
up titles. Your titles file name will match your program name but have
the extension ".titles". If you know another titles member that closely
matches the program defined to "prog" then you can copy it across like
this:
cp oldprog.titles $prog.titles |
But if you want to start with a fresh set of titles (or wish to edit
the current titles) then just run the command "titles" like this:
titles |
When you do this, an editor window is opened with your titles information.
A fresh set of titles is shown below. It was created for the program "t_fpatdem"
and you will see that this program name was added automatically. The header
contains instructions on how to fill in the details. Right at the top of
the header, in the second line, it says "You must only have ONE set of
titles in this file". Certainly you will not be allowed to have multiple
entries for different programs. But you can have multiple
entries for the same program, though your site standards
may strongly discourage this. But sometimes you have no choice, despite
site standards. For example, if you use "proc lifetest" then you will probably
create a table from the output dataset but you will need to put the output
from the procedure into a listing. You should not have a separate program
- one for the table and one for the procedure output - because you have
to be sure the procedure output exactly matches the information in your
table. So in this case, no matter what your site standards are, you will
need two entries - one for the table and one for the listing. To add an
extra entry, just copy the block where you enter information and place
it below. You then have to add a "label" line and give the label a value
like "a" like this:
program: t_fpatdem
label: a |
It is best to put the "label:" line under the "program:" line. Your
output file will normally have the extension ".lis" (like a .lst file but
with page numbers added) but if you use the label "a" then the extension
will be ".lisa". The label suffixes the extension. And whereas the command
"lis" (mentioned above) will open the output file with a ".lis"
extension in a browser window, the command "lis a" will open the
output file with a ".lisa" extension in a browser window.
#===========================================================================================================================================
# 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: # # DRUG: XXXXX_xxx # # STUDY: xx_xx_xx # # INC: xxx # # DATE: 03-Feb-2006 # #===================== 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) # # 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: t_fpatdem 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 |
Below is shown details you might fill in for the program "t_fpatdem"
(the header and column rulers are removed).
program: t_fpatdem
layout: p10 population: fas sascode: %inc alloc m_patdem; %m_patdem titles below: Table 13.2.1 PATIENT DEMOGRAPHICS footnotes below: endxxx: |
If you look at the entry above, you will see that I have chosen a portrait 10 point font size layout. The population is "fas" and this will match one of the populations set up in the file "protocol.txt" by the administrator. The first title is "Table 13.2.1" and the second title is "PATIENT DEMOGRAPHICS". The first title is definitely a changeable title and so should go in this file but "Patient Demographics", at first sight, looks like it should go in the reporting macro because it is a stable title. But sometimes you have "subjects" in a study rather than "patients" (they may be healthy volunteers) so because this word might change I have put it in the titles file and left it out of the reporting macro. There are no footnotes defined above. There will be footnotes in the report but these are closely linked to what the reporting macro is doing.
Now take a look at the "sascode:" entry above. This will be explained further in the next section.
sascode: %inc alloc m_patdem; %m_patdem |
The above is real SAS software code that will be used to create the
report. Because something is defined to "sascode:", a dummy program using
SAS software code will be generated with this program code in - namely
"%inc alloc m_patdem; %m_patdem".
Note that the dummy program
generated will have the same name as your titles member but with the extension
".sas" so do not both use sascode: and have a genuine program of that name
as it will get overwritten. This is a real example from a study I am
working on at the moment. In an ideal world, the entry would simply be:
sascode: %m_patdem |
...but I have to call a macro named "%alloc" to allocate libraries and since the study program library is not defined to the "sasautos" path, which contains the study specific macros I am using, then I have to include the macro "m_patdem" before I can use it. In an ideal world, this allocation of libraries and adding all the macros you need to the "sasautos" path should be done when you invoke SAS software. Using "sascode:" like this, and putting calls to reporting macros in the titles member, is the power of Spectre and how it aims at the ultimate goal of producing reports directly from the data. This is why I wrote Spectre. It is intended to be used in this way for tables, at least. You should aim to produce as many tables as you can using a short call to a reporting macro in the "sascode:" entry as shown above.
There are two global macro variables you will use in your titles or
footnotes. &_poplabel_ is the population label. If the titles
macro sees that defined to the titles in the titles member then it will
resolve it and the client titles macro should not repeat it after the titles,
if the macro works in that way. Another very common first footnote is &_longline_
which resolves to a line of underscores that is the same width as the page.
It is traditional to have this as a footnote, even if it is the only one,
as it gives the message to anyone reading the report that no lines of data
have been accidentally missed off due to a truncated file (or the printer
running out of toner/ink). The complete list of global macro variables
set up is covered on the page that deals with the %titles macro, the next
page to read (you can link to it here) but &_poplabel_
and &_longline_ are the only ones you will need to remember for use
in titles and footnotes. Here is an example of these being used in a titles
member.
titles below:
TABLE 13.4.5.1 PATIENT DEMOGRAPHICS - &_poplabel_ footnotes below: &_longline_ endxxx: |
crtitlesds |
When invoked it will run on all titles members owned by all programmers in that directory. It will do error checking to make sure the the table reference number is not already in use and it will check that the program name used in the titles member matches the file name of the titles member.
When you start using Spectre you will often forget to run the "crtitlesds" script after making changes. Even I forget, sometimes, and I have been using the system for two years. For example, you may need ot use more columns so you might change the layout to use a smaller font. You run your code again and nothing has changed. That is because you forgot to run "crtitlesds" to update the information in the titles dataset.
/*
/ Program : t_fpatdem.sas / Author : Automatically generated by the "crtitlesds" script / Date : 8-Feb-2006 at 08:39:31 / Drug : XXXXX_xxx / Protocol : xx_xx_xx / Increment : xxx / Notes : Do not edit this member as it will get overwritten next time / "crtitlesds" is run. If you wish to change the code you must / change it in the .titles member. /==============================================================================*/ %inc alloc m_patdem; %m_patdem |
Here is what I get when I use it for t_fpatdem (which has been defined
to the Unix variable "prog"):
showtitles $prog
Program: t_fpatdem
|
You might think it is reading your titles member, but it is definitely reading the titles dataset. You will see, from the above, that the "label" is a blank and it does not show footnotes as there are none in the titles dataset.
Note that if you use the command "showtitles" it will show you all the titles entries. Not just for you but for the other programmers as well.
Use the "Back" button of your browser to return to the previous page.
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.