Private Sub cmdNext_Click() 'VB6 Code by Jeffrey S. Morrison - used for S-Plus 7.0 Tree (C.A.R.T.) 'User Inputs (i.e. simple VB6 objects have to be placed to capture the following... '======================================================================================== 'myperm is a user input specifying the SAS Path 'text1.text is a user input specifying the number of nodes desired after pruning 'myfile is a user input specifying the file name 'lstDest is the listbox containing the name of the independent variables in the tree 'label6.caption is the name of the dependent variable in the tree '======================================================================================== 'Program collects these user inputs then builds the S-Plus script and submits it 'to S-plus. S-Plus is called up and the script is presented to the user for review. 'When satisfied, the user simply executes the script in S=-Plus. SIMPLE! 'begin program... myperm = tree.Label4.Caption myfile = tree.Label5.Caption Open "c:\GUI_SAS_MODELING\tree.ssc" For Output As #10 'This part of the script reads data in from SAS version 7. We call it MYTREE. Print #10, "guiImportData(FileName = '" & Left(myperm, 1) & ":\\" & Right(myperm, Len(myperm) - 3) & "\\" & myfile & ".sas7bdat'" Print #10, ", FileTypes = 'SAS Version 7 (sas7bdat)', TargetDataFrame = 'mytree', TargetStartCol = ''," Print #10, "TargetInsertOverwrite = 'Create new data set', NameRowAuto = 'Auto', NameColAuto = 'Auto'," Print #10, "StartCol = 1, EndCol = '', StartRow = 1, EndRow = '', PageNumberAuto = 'Auto'," Print #10, "StringsAsFactors = T, SortFactorLevels = T, LabelsAsNumbers = F, CenturyCutoffYear = 1930," Print #10, "KeepOrDropList = '', SeparateDelimiters = T, ASCIIDateInFormat = 'M/d/yy'," Print #10, "ASCIITimeInFormat = 'h:mm:ss tt', ASCIIDecimalPoint = 'Period (.)'," Print #10, "ASCIIThousandsSeparator = 'None')" Print #10, "mytree <- convert.col.type(target = mytree, column.spec = list('" & Label6.Caption & "'), column.type = 'factor')" 'This part of the script does the TREE. Print #10, "menuTree(formula = " Print #10, Label6.Caption & "~" For I = 0 To lstDest.ListCount - 1 If Not (I = lstDest.ListCount - 1) Then Print #10, lstDest.List(I) & "+" If I = lstDest.ListCount - 1 Then Print #10, lstDest.List(I) Next I Print #10, ", data = mytree, na.omit.p = T, mincut = 5, minsize = 10, mindev = 0.010," Print #10, "print.summary.p = T, print.tree.p = T, saveRsdMisclass = F, saveRsdPearson = F," Print #10, "saveRsdDeviance = F, plot.it = F, plotUniform = T, plot.addText = T," Print #10, "plot.addText.what = 'Response-Value', prune.p = T, prune.k = NULL, prune.best =" & Text1.Text & "," Print #10, "prune.method = 'deviance', shrink.p = F, shrink.k = (1:10)/(20:11)," Print #10, "plot.seq = T, predict.type = 'response')" Close #10 myfile = "c:\GUI_SAS_MODELING\tree.ssc" ShellExecute Me.hwnd, vbNullString, myfile, vbNullString, "", SW_SHOWNORMAL End Sub