PHP code example of openstatspec / spss-sav

1. Go to this page and download the library: Download openstatspec/spss-sav library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

openstatspec / spss-sav example snippets


use SPSS\Sav\Reader;

$dataset = Reader::fromFile('/path/to/input.sav')->readDataset();

foreach ($dataset->rows() as $row) {
    // Values follow the order of $dataset->variables().
}

use SPSS\Sav\Writer;

$writer = new Writer($dataset);
$writer->save('/path/to/output.sav');
$writer->close();