'The following script will determine quickly the # of cases 'And tell you if your base is weighted or not. If it is, it 'will prompt you whether you want or not to calculate the 'weighted number of cases. If you choose OK, it will: 'Turn the weight off 'Get the sum of the weight var (descriptives), which is equal 'To the weighted number of cases 'Turn the weight on again. 'You can create a custom menu item that points to the script 'file, or choose run script from utilities menu. 'This solution is very handy for unweighted bases. 'RGDS 'Rafael Osorio (usenet 11 May 2000)re:Finding number of cases Option Explicit Dim DtDoc As ISpssDataDoc Dim OutDoc As ISpssOutputDoc Dim WeightName As String Dim Cmd As String Sub Main Set DtDoc = objSpssApp.Documents.GetDataDoc(0) WeightName = DtDoc.GetWeightingVariable(False) If WeightName = "" Then MsgBox "Weight is off: number of cases = "&DtDoc.GetNumberOfCases Else If MsgBox("Weight (" &WeightName &") is on:UNWEIGHTED number of cases = " _ &DtDoc.GetNumberOfCases &". Press OK to calculate the weighted number.", 1) = 2 _ Then Exit Sub Set OutDoc = objSpssApp.NewOutputDoc OutDoc.Visible = True Cmd = "WEIGHT OFF." & vbCr Cmd = Cmd &"FILTER OFF." & vbCr Cmd = Cmd &"DESCRIPTIVES " & WeightName & "/STATISTICS=SUM." &vbCr Cmd = Cmd &"WEIGHT BY " & WeightName &"."&vbCr objSpssApp.ExecuteCommands Cmd, False End If End Sub