Importing dataset with a lot of variables - Statistica Visual Basic - Statistica - Dell Community

Importing dataset with a lot of variables

Importing dataset with a lot of variables

This question is not answered

Hi,

I need to import a dataset in statistica 8.0  with 1860 variables (all double, except  the first column that is a categorical variable)

Dataset is a csv file and decimal separator is comma. Statistica import the frist 400 columns as double and the other as text.

It si very hard to change all manually

How can I fix it?

Thanks

All Replies
  • I use a SVB macro to change text  values for a couple of variables. I think you could use a SVB macro to update the variable type. I will look for an examlpe.

     

    Mara

  • I found an SVB macro example that will change the variable type to double after you import your data. Maybe someone has a macro that lets you set the variable type as you import from .csv?

    Make sure your STATISTICA spreadsheet is open and then create the macro. To create a new macro in STATISTICA, select the File menu, New menu. A window opens. Clilck on the Macro tab and click the OK button. Copy the text below. Paste it after "Sub Main".

    Type "F5" to run the macro.

     

        Dim S1 As Spreadsheet
        Set S1 = ActiveDataSet

        Dim i As Long

        For i=2 To S1.NumberOfVariables
            S1.Variable(i).ColumnType = scDouble
        Next i

     

    Mara

  • STATISTICA comes with many example SVB macros including "Spreadsheet Data Type Convert.svb". This macro converts the variable type. It will let you select which variables you want to convert. It is a little more complex then Mara's macro, but does do the same thing.

    Look in C:\Program Files\StatSoft\STATISTICA 8\Examples\Macros\Spreadsheet Examples for this macro.

    If you don't see "Spreadsheet Data Type Convert.svb", you can download it from STATISTICA Visual Basic Examples page.

     

    Angela Waner,
    StatSoft Project Manager

     

     

  • Thank you very much for your suggestions