=for comment PSPP - a program for statistical analysis.
=for comment Copyright (C) 2019 Free Software Foundation, Inc.
-=for comment
+=for comment
=for comment This program is free software: you can redistribute it and/or modify
=for comment it under the terms of the GNU General Public License as published by
=for comment the Free Software Foundation, either version 3 of the License, or
=for comment (at your option) any later version.
-=for comment
+=for comment
=for comment This program is distributed in the hope that it will be useful,
=for comment but WITHOUT ANY WARRANTY; without even the implied warranty of
=for comment MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
=for comment GNU General Public License for more details.
-=for comment
+=for comment
=for comment You should have received a copy of the GNU General Public License
=for comment along with this program. If not, see <http://www.gnu.org/licenses/>.
-
+
=head1 PSPP::Examples
This page shows some simple examples of using the PSPP module.
=head2 A Simple example
-This example creates a system file called F<foo.sav>, containing one
+This example creates a system file called F<foo.sav>, containing one
variable called "id". It contains no data.
use PSPP;
my $dict = PSPP::Dict->new ();
PSPP::Var->new ($dict, "id",
(fmt=>PSPP::Fmt::F, width=>2, decimals=>0) );
-
+
PSPP::Var->new ($dict, "name", (fmt=>PSPP::Fmt::A, width=>80) );
PSPP::Var->new ($dict, "dob", (fmt=>PSPP::Fmt::DATETIME) );
use PSPP;
my $dict = PSPP::Dict->new ();
- PSPP::Var->new ($dict, "id",
+ PSPP::Var->new ($dict, "id",
(fmt=>PSPP::Fmt::F, width=>2, decimals=>0) );
PSPP::Var->new ($dict, "name", (fmt=>PSPP::Fmt::A, width=>8) );
=head2 Variables with differing input and output formats
By default, a variable's output format corresponds to the input format.
-However, the output format may be changed after the variable has
+However, the output format may be changed after the variable has
been created.
This example shows how to create a DATETIME variable using the current time
-as its value. Since pspp uses a different epoch to perl, the constant
-PSPP::PERL_EPOCH needs to be added to the value returned from time(), in order
+as its value. Since pspp uses a different epoch to perl, the constant
+PSPP::PERL_EPOCH needs to be added to the value returned from time(), in order
that it be correctly represented by pspp.
use PSPP;
my $dict = PSPP::Dict->new ();
- my $var1 = PSPP::Var->new ($dict, "entrytime",
+ my $var1 = PSPP::Var->new ($dict, "entrytime",
(fmt=>PSPP::Fmt::F) );
$var1->set_output_format ( (fmt=>PSPP::Fmt::DATETIME, width=>20) );
my $now = time ();
- $sysfile->append_case ( [ $now + PSPP::PERL_EPOCH] )
+ $sysfile->append_case ( [ $now + PSPP::PERL_EPOCH] )
|| die "Cant write case";
-
+
$sysfile->close();
=head2 Reading data