bug-gnu-pspp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PSPP-BUG: bug report


From: Ben Pfaff
Subject: Re: PSPP-BUG: bug report
Date: Sun, 16 Dec 2007 19:08:07 -0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

"Gay" <address@hidden> writes:

> I attach a SPSS 16 file that Pspp doesn't read and a short pdf report.
> Two possible reasons:
> 1. string variables wider than 8 characters may now (SPSS 16) have value
> labels
> 2. string variables may now have missing values (although the missing values
> should be no longer than 8 characters)

It's really reason #2.  I'm appending a patch that ignores
missing values for string variables wider than 8 characters.
This is not the "correct" behavior (it will emit a warning), but
implementing long string missing values will take some work, so I
would prefer to wait until PSPP 0.6.0 is released before taking
it on.

This is also available on Savannah:
        http://savannah.gnu.org/patch/index.php?6347

Index: b/src/data/sys-file-reader.c
===================================================================
--- a/src/data/sys-file-reader.c
+++ b/src/data/sys-file-reader.c
@@ -548,11 +548,14 @@ read_variable_record (struct sfm_reader 
           for (i = 0; i < missing_value_code; i++)
             mv_add_num (&mv, read_float (r));
         }
-      else if (var_get_width (var) <= MAX_SHORT_STRING)
+      else
         {
           if (missing_value_code < 1 || missing_value_code > 3)
             sys_error (r, _("String missing value indicator field is not "
                             "0, 1, 2, or 3."));
+          if (var_is_long_string (var))
+            sys_warn (r, _("Ignoring missing values on long string variable "
+                           "%s, which PSPP does not yet support."), name);
           for (i = 0; i < missing_value_code; i++)
             {
               char string[9];
@@ -560,10 +563,8 @@ read_variable_record (struct sfm_reader 
               mv_add_str (&mv, string);
             }
         }
-      else
-        sys_error (r, _("Long string variable %s may not have missing "
-                        "values."), name);
-      var_set_missing_values (var, &mv);
+      if (!var_is_long_string (var))
+        var_set_missing_values (var, &mv);
     }
 
   /* Set formats. */
@@ -751,6 +752,18 @@ read_extension_record (struct sfm_reader
          SPSS 14. */
       break;
 
+    case 20:
+      /* New in SPSS 16.  Contains a single string that describes
+         the character encoding, e.g. "windows-1252". */
+      break;
+
+    case 21:
+      /* New in SPSS 16.  Encodes value labels for long string
+         variables. */
+      sys_warn (r, _("Ignoring value labels for long string variables, "
+                     "which PSPP does not yet support."));
+      break;
+
     default:
       sys_warn (r, _("Unrecognized record type 7, subtype %d."), subtype);
       break;

-- 
"Now I have to go wash my mind out with soap."
--Derick Siddoway




reply via email to

[Prev in Thread] Current Thread [Next in Thread]