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
Option Explicit

Sub Main
' This script generates an empty data file with n cases'
' (where n is supplied by the user)
' Posted to SPSS newsgroupd on 2004/04/10 by Raynald Levesque

	Dim strCmd As String
	Dim vNbCases As Variant
	Dim lngNumCases As Long

	Do
		vNbCases =InputBox("Create empty data file with how cases?", "Input # of cases","100")
		If vNbCases = "" Then Exit Sub
	Loop Until IsNumeric(vNbCases)

	strCmd = strCmd & "NEW FILE." & vbCrLf
	strCmd = strCmd & "INPUT PROGRAM." & vbCrLf
	strCmd = strCmd & "LOOP id=1 TO " & vNbCases & "." & vbCrLf
	strCmd = strCmd & "END CASE." & vbCrLf
	strCmd = strCmd & "END LOOP." & vbCrLf
	strCmd = strCmd & "END FILE." & vbCrLf
	strCmd = strCmd & "END INPUT PROGAM." & vbCrLf
	strCmd = strCmd & "FORMATS id (F8)." & vbCrLf
	strCmd = strCmd & "EXECUTE." & vbCrLf

	objSpssApp.ExecuteCommands (strCmd,False)
End Sub