1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SPSS AnswerNet: Result 

Solution ID:	 	100000737	
Title:
Printing date and time in the output file 
Description:
Q. 
I need to produce the date and time at select places of my output 
file. This will give me an idea of how long it took for a procedure 
to execute. Is there a way I can do this? 
A. 
Yes, there is. Place the following code into a file. Use the 
INCLUDE command to load the macro. Anytime you need the date and 
time simply enter the macro call DSPDATIM in your syntax file. 
The date and time will appear just before the output from your next 
procedure. 
Here is an example of the macro (called DSPDATIM - you may use 
your own name here if you wish) that will display the date and 
time. 

** MACRO TO DISPLAY DATE AND TIME in listing file ** . 
DEFINE DSPDATIM ( ) . 
PRESERVE . 
SET PRINTBACK OFF/MPRINT OFF. 
DO IF ($CASENUM=1). 
PRINT / 'The Date and Time is ', $TIME (DATETIME) . 
END IF. 
RESTORE. 
!ENDDEFINE . 
*SAMPLE MACRO CALL *. 
DSPDATIM . 
EXE . 
* The result *. 
*The Date and Time is 17-JAN-2000 16:14:11