VERSION 5.00 Begin VB.Form RankEmployment BorderStyle = 1 'Fixed Single Caption = "Employment opportunity indices" ClientHeight = 5070 ClientLeft = 45 ClientTop = 390 ClientWidth = 7500 BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Icon = "RankEmployment.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False ScaleHeight = 5070 ScaleWidth = 7500 StartUpPosition = 3 'Windows Default Begin VB.CommandButton Command3 Caption = "Done" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 4080 TabIndex = 7 Top = 4560 Visible = 0 'False Width = 1575 End Begin VB.CommandButton Command2 Caption = "Continue" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 4080 TabIndex = 5 Top = 4560 Visible = 0 'False Width = 1575 End Begin VB.Frame Frame1 Caption = "Number of regions read:" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 735 Left = 120 TabIndex = 3 Top = 4200 Visible = 0 'False Width = 2415 Begin VB.TextBox Text1 BeginProperty Font Name = "Fixedsys" Size = 9 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 330 Left = 120 Locked = -1 'True TabIndex = 4 Text = "Text1" Top = 310 Width = 2055 End End Begin VB.CommandButton Command1 Caption = "Start" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 375 Left = 5760 TabIndex = 2 Top = 4560 Width = 1575 End Begin VB.ListBox List1 BeginProperty Font Name = "Fixedsys" Size = 9 Charset = 0 Weight = 400 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty Height = 3540 IntegralHeight = 0 'False Left = 120 TabIndex = 0 Top = 480 Visible = 0 'False Width = 7215 End Begin VB.Label Label2 BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = "This an EasyReg space delimited data file. Merge it with the original data" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H00FF0000& Height = 375 Left = 120 TabIndex = 6 Top = 4080 Visible = 0 'False Width = 7215 End Begin VB.Label Label1 BackColor = &H00FFFFFF& BorderStyle = 1 'Fixed Single Caption = "Label1" BeginProperty Font Name = "Arial" Size = 9 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000FF& Height = 3735 Left = 120 TabIndex = 1 Top = 120 Width = 7215 End End Attribute VB_Name = "RankEmployment" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False DefDbl A-Z Private Sub Command1_Click() Command1.Visible = False On Error Resume Next Dim k As Integer Dim t As Integer Close Open "EMPLOYMENT.TXT" For Input As #1 Input #1, k, misval# ReDim VarName$(1 To k) For t = 1 To k Line Input #1, VarName$(t) List1.AddItem VarName$(t) Next t ReDim x(1 To k) Dim n As Long n = 0 While Not EOF(1) For t = 1 To k Input #1, x(t) Next t n = n + 1 Wend Label1.Caption = "Variables in file EMPLOYMENT.TXT" Label1.Height = List1.Top - Label1.Top Text1.Text = Trim(Str$(n)) Frame1.Visible = True List1.Visible = True Command2.Left = Command1.Left Command2.Visible = True Exit Sub If Err Then Close Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + "File " + App.Path + "\EMPLOYMENT.TXT is missing or corrupt!" End If End Sub Private Sub Command2_Click() Command2.Visible = False Frame1.Visible = False Dim n As Long n = Val(Text1.Text) Dim k As Integer Dim t As Integer Dim i As Long Dim ii As Long Close Open "EMPLOYMENT.TXT" For Input As #1 Input #1, k, misval# ReDim VarName$(1 To k) For t = 1 To k Line Input #1, VarName$(t) Next t ReDim Employment(1 To n, 1 To k) For i = 1 To n For t = 1 To k Input #1, Employment(i, t) Next t Next i Close ReDim RankName$(2 To k) ReDim RankVal(1 To n, 2 To k) For t = 2 To k RankName$(t) = "Fraction > %change(" + VarName$(t) + ")" For i = 1 To n RankVal(i, t) = 0 diffi = (Employment(i, t) - Employment(i, t - 1)) / Employment(i, t - 1) For ii = 1 To n diffii = (Employment(ii, t) - Employment(ii, t - 1)) / Employment(ii, t - 1) If diffii > diffi Then RankVal(i, t) = RankVal(i, t) + 1 Next ii RankVal(i, t) = RankVal(i, t) / n Next i Next t Label1.Caption = App.Path + "\INDICES.TXT, containing:" Open "INDICES.TXT" For Output As #1 Print #1, k - 1, 0 List1.Clear For t = 2 To k Print #1, RankName$(t) List1.AddItem RankName$(t) Next t For i = 1 To n For t = 2 To k Print #1, Format$(RankVal(i, t), "0.000000000") + " "; Next t Print #1, "" Next i Close Caption = "Output file:" Label2.Visible = True Command3.Left = Command2.Left Command3.Visible = True End Sub Private Sub Command3_Click() End End Sub Private Sub Form_Load() Label1.Caption = "This program converts employment per region per year to employment opportunity indices, in the same way as done in " Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + "Bierens, HJ, Kontuly T (2007), Testing the Regional Restructuring Hypothesis in Western Germany, forthcoming in Environment & Planning A." Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + "The input file is " Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + App.Path + "\EMPLOYMENT.TXT" Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + "which is an EasyReg space delimited data file containing only employment variables, in order of years. There should be no missing values in this data file! " Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + Chr$(13) + Chr$(10) Label1.Caption = Label1.Caption + "Create this file via EasyReg menu " + Chr$(34) + "Menu > Data analysis > Make data table" + Chr$(34) + ", and uncheck the box " + Chr$(34) + "Include the observation numbers in the file" + Chr$(34) + "." ChDir App.Path Show End Sub