How to get the running time from SPSS

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get the running time from SPSS

albert_sun
Hi, all:


Is there a way to output the running time of macro in SPSS?

Thanks,

Reply | Threaded
Open this post in threaded view
|

Re: How to get the running time from SPSS

Jon K Peck
A macro expands to one or more commands, so it doesn't have any execution life of its own.  However, the Notes table shows the elapsed time for each procedure.  Transformations preceding a procedure would be included in that time.  You can also precede and follow the macro with SHOW $VARS and subtract the times.

If you want to get deeper into benchmarking, check out the STATS BENCHMARK extension command.  It takes some setup and only works on Windows, but it can give you a lot more information about Statistics resource use (memory, time, i/o, etc).


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        albert_sun <[hidden email]>
To:        [hidden email]
Date:        10/05/2014 06:14 PM
Subject:        [SPSSX-L] How to get the running time from SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Hi, all:


Is there a way to output the running time of macro in SPSS?

Thanks,





--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-get-the-running-time-from-SPSS-tp5727499.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: How to get the running time from SPSS

David Marso
Administrator
In reply to this post by albert_sun
Try the following ideas:

DEFINE !ProfileStart().
DATASET DECLARE @profile@.
MATRIX.
SAVE MAKE(1,1,1) / OUTFILE @profile@.
END MATRIX.
DATASET ACTIVATE @profile@.
COMPUTE @StartTime@=$TIME.
EXECUTE.
!ENDDEFINE.

DEFINE !ProfileEnd( !Pos !CMDEND).
DATASET ACTIVATE @profile@.
COMPUTE @EndTime@=$TIME.
COMPUTE @ElapsedTime@=@EndTime@-@StartTime@.
PRINT /"Macro:" !1
      /"Beginning:"       @StartTime@ (DATETIME)
      /"Ending:"          @EndTime@ (DATETIME)
      /"Elapsed Seconds:" @ElapsedTime@.
EXECUTE.
DELETE VARIABLES @StartTime@ @EndTime@ @ElapsedTime@.
DATASET CLOSE  @profile@.
!ENDDEFINE.

DEFINE !Profiler (!POS !CHAREND("/") /!POS !CMDEND ).
PRESERVE.
SET PRINTBACK OFF.
!ProfileStart.
DATASET ACTIVATE !2.
!UNQUOTE(!1).
!ProfileEnd !1.
DATASET ACTIVATE !2.
RESTORE.
!ENDDEFINE.

/*Data simulation */.
MATRIX.
SAVE TRUNC(UNIFORM(1000000,1)*100) / OUTFILE * / VARIABLES X1.
END MATRIX.
DATASET NAME rawdata.


DEFINE !Junk().
FREQ ALL.
!ENDDEFINE.

!Profiler "!Junk" / rawdata .




albert_sun wrote
Hi, all:


Is there a way to output the running time of macro in SPSS?

Thanks,
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: How to get the running time from SPSS

Jon K Peck
Simpler:

begin program.
import time
t0 = time.time()
end program.

freq jobcat.

begin program.
print "Elapsed time in seconds:", time.time() - t0
t0 = time.time()
end program.

The second block reports the elapsed time since the first block or the second block was run.


Jon Peck (no "h") aka Kim
Senior Software Engineer, IBM
[hidden email]
phone: 720-342-5621




From:        David Marso <[hidden email]>
To:        [hidden email]
Date:        10/06/2014 07:29 AM
Subject:        Re: [SPSSX-L] How to get the running time from SPSS
Sent by:        "SPSSX(r) Discussion" <[hidden email]>




Try the following ideas:

DEFINE !ProfileStart().
DATASET DECLARE @profile@.
MATRIX.
SAVE MAKE(1,1,1) / OUTFILE @profile@.
END MATRIX.
DATASET ACTIVATE @profile@.
COMPUTE @StartTime@=$TIME.
EXECUTE.
!ENDDEFINE.

DEFINE !ProfileEnd( !Pos !CMDEND).
DATASET ACTIVATE @profile@.
COMPUTE @EndTime@=$TIME.
COMPUTE @ElapsedTime@=@EndTime@-@StartTime@.
PRINT /"Macro:" !1
     /"Beginning:"       @StartTime@ (DATETIME)
     /"Ending:"          @EndTime@ (DATETIME)
     /"Elapsed Seconds:" @ElapsedTime@.
EXECUTE.
DELETE VARIABLES @StartTime@ @EndTime@ @ElapsedTime@.
DATASET CLOSE  @profile@.
!ENDDEFINE.

DEFINE !Profiler (!POS !CHAREND("/") /!POS !CMDEND ).
PRESERVE.
SET PRINTBACK OFF.
!ProfileStart.
DATASET ACTIVATE !2.
!UNQUOTE(!1).
!ProfileEnd !1.
DATASET ACTIVATE !2.
RESTORE.
!ENDDEFINE.

/*Data simulation */.
MATRIX.
SAVE TRUNC(UNIFORM(1000000,1)*100) / OUTFILE * / VARIABLES X1.
END MATRIX.
DATASET NAME rawdata.


DEFINE !Junk().
FREQ ALL.
!ENDDEFINE.

!Profiler "!Junk" / rawdata .





albert_sun wrote
> Hi, all:
>
>
> Is there a way to output the running time of macro in SPSS?
>
> Thanks,





-----
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/How-to-get-the-running-time-from-SPSS-tp5727499p5727511.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD


===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD