' This script asks for the user name, then defines the macro !usrname which gives the user name ' It then prints the user name in the Log file. ' Usage: ' After running this script, the username may be printed anywhere in ' the Output using, for instance, the following syntax ' DO IF $CASENUM=1. ' Print /'*** Syntax ran by ' !usrname. ' End If. ' EXECUTE. ' It is possible to have SPSS automatically run the script each time SPSS starts ' see "Automatically run a script or syntax when SPSS starts.SBS" in ' http://pages.infinit.net/rlevesqu/SampleScripts.htm#Utils ' Raynald Levesque 2002/01/27 Option Explicit Sub Main Dim username As String Dim CmdStr As String username = InputBox$("Enter your name:","Input Box") ' Debug.Print username Cmdstr = "DEFINE !usrname()" & "'" & username & "'" & "!ENDDEFINE." & vbCr & "Execute." & vbCr Cmdstr = Cmdstr & "DO IF $CASENUM=1." & vbCr Cmdstr = Cmdstr & "STRING #tmpstr(A20)." & vbCr Cmdstr = Cmdstr & "COMPUTE #tmpstr=!usrname." & vbCr Cmdstr = Cmdstr & "PRINT /'*** Syntax ran by ' #tmpstr." & vbCr Cmdstr = Cmdstr & "END IF." & vbCr Cmdstr = Cmdstr & "EXECUTE." & vbCr objSpssApp.ExecuteCommands Cmdstr,True ' objSpssApp.GetDesignatedOutputDoc.PrintOptions.FooterText = "Ran by: " & username End Sub