manonz.SpssWriter 1.0.1

dotnet add package manonz.SpssWriter --version 1.0.1
                    
NuGet\Install-Package manonz.SpssWriter -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="manonz.SpssWriter" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="manonz.SpssWriter" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="manonz.SpssWriter" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add manonz.SpssWriter --version 1.0.1
                    
#r "nuget: manonz.SpssWriter, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=manonz.SpssWriter&version=1.0.1
                    
Install manonz.SpssWriter as a Cake Addin
#tool nuget:?package=manonz.SpssWriter&version=1.0.1
                    
Install manonz.SpssWriter as a Cake Tool

C# SPSS SAV file reader and writer library

This library enables to write SPSS data files (.sav). The library is UTF-8 safe.

It is available as a nuget package at https://www.nuget.org/packages/manonz.SpssWriter, and can be installed using the package manager or by issuing:

Install-Package manonz.SpssCommon
Install-Package manonz.SpssWriter

It's a fork of https://github.com/Anderman/Medella.SPSS adding the ability to handle multiple-response variables.

To write a data file:

// Create Variable list
    var variables = new List<Variable>
    {
        new Variable<string>("var0", 8)
        {
            Label = "label for var0",
            ValueLabels = new Dictionary<string, string>
            {
                ["a"] = "valueLabel for a",
                ["b"] = "valueLabel for b"
            }
        }.UserMissingValues(MissingValueType.OneDiscreteMissingValue, new[] { "-" }),
        new Variable<double>("var2", 7, 3)
        {
            Label = "label for var2",
            ValueLabels = new Dictionary<double, string>
            {
                [15.5] = "valueLabel for 15.5",
                [16] = "valueLabel for 16"
            }
        }.UserMissingValues(new[] { 0d }),
        new Variable<DateTime>("var4", 20)
        {
            Label = "label for var4",
            ValueLabels = new Dictionary<DateTime, string>
            {
                [new DateTime(2020, 1, 2)] = "valueLabel for 2 jan 2020",
                [new DateTime(2020, 1, 1)] = "valueLabel for 1 jan 2020"
            }
        }
    };
    // create data
    var data = new List<object?>
    {
        "string", 15.5, new DateTime(2020, 1, 1),
        null, null, null
    };

    //Write variable and data to a stream
    var ms = new MemoryStream();
    SpssWriter.Write(variables, data, ms);

If you find any bugs or have issues, please open an issue on GitHub.

SAV file format

Binary description of *.sav file format is available here: http://www.gnu.org/software/pspp/pspp-dev/html_node/System-File-Format.html.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 154 3/12/2025