%titles

(Author: Roland Rashleigh-Berry                                                                        Date: 29 Jun 2006)

Introduction

This page will describe the macro that fetches the titles from the titles dataset and makes them available in your program. It is very simpe to use. You will mainly use it with a simple call in your code like this:
 
%titles

That is all. No semicolon at the end is required (true of nearly all macros).

Most of this page will be about the global macro variables set up by the %titles macro and the macros it calls. To see the macro dependency for the %titles macro then click here.

Global macro variables

Spectre sets up a large number of global macro variables. They all start and end with an underscore. It uses these global macro variables to communicate between macros. You are free to set up your own global macro variables in your code, but they must not both start and end with an underscore as these are reserved for Spectre. You might, in an extreme case, need to change the value of a Spectre global macro variable, but you should never change its usage. Sometimes you may need to resolve one of these global macro variables in your code, so it is important to know which ones are available.

Any time any of the Spectre macros sets up a global macro variable it will write this information to the log. You can see the list of these and what the settings are by looking in the log. Here is part of the log from the program "t_fpatdem". You will see that %titles calls a few macros.

The first set of messages comes from a macro named %jobinfo and this sets up four global macro variables as you can see.
 
MSG: (jobinfo) The following global macro variables have been set up
MSG: (jobinfo) and can be used in your code.
_sysin_=/xxxx/xxx/xxx/xxx/xxxxx_xxx/xx_xx_xx/xxx/dev/t_fpatdem.sas
_prog_=t_fpatdem
_user_=rrash
_path_=/xxxx/xxx/xxx/xxx/xxxxx_xxx/xx_xx_xx/xxx/dev

The second set of messages comes from the macro %protinfo. It reads in all the protocol information. The Spectre administrator sets up a file named "protocol.txt" in the programs folder with this information in. You have already heard about the "titles" dataset. Well, there is a "protocol" dataset as well. As a programmer, you will probably only be interested in the _pop(n)_ settings. You will see that only two values "FAS" and "PPS" are available. If you enter a value in the "pop:" line in your titles member then it must be one of these or you will get an error message.

Before we leave this one, have a look at the "_titlestyle_=xy". "xy" is the client title style. Spectre is designed to work with multiple clients (companies). Each client will have their own title style so the %titles macro will call the client titles macro which will be called %xytitles in this case. This client macro might change the settings of some of the global macro variables, but it should report on it if it does.
 
MSG: (protinfo) The following global macro variables have been set up
MSG: (protinfo) and can be resolved in your code. This information
MSG: (protinfo) is held in the file "protocol.txt".
_drugname_=XXXXX
_protocol_=Protocol No. XX-xxx-xx-xx
_report_=Report No. XX-xxx-xx-xx, Draft Version,
_paper_=A4
_lmargin_=1.0
_rmargin_=0.75
_tmargin_=1.0
_bmargin_=1.0
_titlestyle_=xy
_dflayout_=P10
_dfllayout_=L10
_dfplayout_=P10
_dfltlayout_=LT10
_dfptlayout_=PT10
_clean_=clean in (0,1)
_pop1_=FAS
_poplabel1_=Full Analysis Set
_pop2_=PPS
_poplabel2_=Per-Protocol Set
_pop3_=
_poplabel3_=
_pop4_=
_poplabel4_=
_pop5_=
_poplabel5_=
_pop6_=
_poplabel6_=
_pop7_=
_poplabel7_=
_pop8_=
_poplabel8_=
_pop9_=
_poplabel9_=

The next set of messages comes from the macro %proginfo. Take a look at the _repsort_ value. It has used the "13.2.1" in the first title to form a sort key. This sort key will be used to sort the output into the correct order. I call "13.2.1" a reference number and the same reference number can not be used twice. You can't have a "Listing 13.2.1" as well as a "Table 13.2.1". It is not allowed and will result in an error message. Note that _rotate_ , _device_ , _vsize_ , _hsize_ , _vorigin_ and _horigin_ contain values for figures. The macro %openrep will use these values in a "goptions" statement if you are creating a figure.  The _longline_ setting is useful. You can use this in your titles member. You would typically use it as the first footnote with the entry "&_longline_". The length of it will be the same as the linesize of your report (shown assigned to _ls_) so it will span the full width of the report.
 
MSG: (proginfo) The following global macro variables have been set up and can be
MSG: (proginfo) used in your code. The information is a combination of what was
MSG: (proginfo) in the .titles file for that program and what is in "protocol.txt"
_layout_=L10
_rotate_=landscape
_device_=PS300A4
_vsize_=6.52in
_hsize_=9.7in
_vorigin_=0.75in
_horigin_=1.0in
_pop_=FAS
_poplabel_=Full Analysis Set
_reptype_=TABLE
_repid_=Table 13.2.1
_replabel_=
_repsort_=013-002-001-000-000-000
_ls_=116
_ps_=42
_longline_=____________________________________________________________________________________________________________________

The next set of messages comes from the client titles macro named %xytitles. In this case it might reset the _repid_ value and the _poplabel_ value so it reports on this. This client titles macro changes case to capitals for tables. It does not do this for listings or appendix tables. Like I wrote above, each client has their own titles style. The global macro variable _figbkmark_ is set up to contain pdf bookmark text for figures. It is not used for tables and listings as the bookmark will be found by reading the first ten lines of each output report.
 
MSG: (xytitles) The following global macro variables have been set
MSG: (xytitles) and can be used in your code.
_repid_=TABLE 13.2.1
_poplabel_=FULL ANALYSIS SET
_tline2_=PATIENT DEMOGRAPHICS
_tline3_=
_tline4_=
_figbkmark_=TABLE 13.2.1 PATIENT DEMOGRAPHICS FULL ANALYSIS SET

After the client titles macro has done its work, the %titles macro counts how many titles and footnotes have been created by calling the %maxtitle macro. You can see that no footnotes were created but eight title lines created. Supposing you wanted to add a new title line in your code. You could do it like this:

title%eval(&_maxtitle_+1) "New title line";
 
MSG: (maxtitle) The following global macro variables have been set up
MSG: (maxtitle) and can be used in your code.
_maxtitle_=8
_maxfoot_=0

%titles with parameters

Normally you just call the %titles macro with no parameters, but if you have set up multiple titles in the same titles file and distinguished them with a label defined to "label:" then to get those titles you have to specify the label. Suppose the label is "a" then you call the macro in this way:
 
%titles(label=a)

If you are writing QC programs then you might want to use the titles of the program you are QCing. Suppose you were QCing the program t_fpatdem then you can call in its titles like this:
 
%titles(program=t_fpatdem)

Invoking the %titles macro gives you the value of the population in the _pop_ global macro variable. You will need to use this to subset the population. So if you need to call the %titles macro with label=a for a listing then you would normally do it like this. The two macros %openrep and %closerep are explained on another page.
 
%titles

proc sort data=stat.acct(keep=patno &_pop_.cd where=(&_pop_.cd=1))
       out=acct(drop=&_pop_.cd);
  by patno;
run;

....other code

%titles(label=a)

%openrep
....produce the listing
%closerep

%titles

%openrep
....produce the table
%closerep

The reason it is done like the above, with three calls to the %titles macro, is because the population is usually only defined for the first instance of the titles and that is for where the label is blank (for the table). So you use %titles to give you the populaiton, %titles(label=a) to give you the titles for the listing and then %titles again to give you the titles for the table.

Conclusion

You have seen how easy it is to include the titles in your code using the %titles macro. You have also been introduced to the large number of global macro variables that are created by some of the macros and you have learned that they are written to the log to inform you that they are available.
 
 

Use the "Back" button of your browser to return to the previous page.

contact the author