I have a text file with 1530 values per record. Each value is five
digits long, no decimal, and each value is separated by a space. I treat each value in a record as a variable and so I have 1530 variables per record. I am using ver 21 of spss and the operating system is Win 7 64 bit with 8 gig memory. When spss reads the data, it creates all 1530 variables, but it just reads the first two digits of the 1,366th variable and and so there is only a two digit number for this variable, instead of a five digit number. SPSS then ignores the rest of the record and continues creating the remaining variables by reading the beginning of the next record. It almost seems as though there is some kind of default record length that needs to be changed. Does anyone know how to correct this? The very simple syntax follows. Stan SET PRINTBACK=YES / EPOCH=AUTOM DATA LIST FREE file='C:\Master_not-normalized.txt' / V1 TO V1530. N 10. COMPUTE CASENUM=$CASENUM. EXECUTE. COMPUTE MAXVAL = MAX(V1 TO V1530). COMPUTE MINVAL = MIN(V1 TO V1530). COMPUTE AVEVAL = SUM(V1 TO V1530)/1530. LIST CASENUM MAXVAL MINVAL AVEVAL. LIST CASENUM V1366 V1367. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
You need to use a FILE HANDLE and declare
a LRECL long enough to handle your lines. The default LRECL is 8192.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Stan Gorodenski <[hidden email]> To: [hidden email], Date: 11/13/2013 08:58 AM Subject: [SPSSX-L] Does not read to end of record Sent by: "SPSSX(r) Discussion" <[hidden email]> I have a text file with 1530 values per record. Each value is five digits long, no decimal, and each value is separated by a space. I treat each value in a record as a variable and so I have 1530 variables per record. I am using ver 21 of spss and the operating system is Win 7 64 bit with 8 gig memory. When spss reads the data, it creates all 1530 variables, but it just reads the first two digits of the 1,366th variable and and so there is only a two digit number for this variable, instead of a five digit number. SPSS then ignores the rest of the record and continues creating the remaining variables by reading the beginning of the next record. It almost seems as though there is some kind of default record length that needs to be changed. Does anyone know how to correct this? The very simple syntax follows. Stan SET PRINTBACK=YES / EPOCH=AUTOM DATA LIST FREE file='C:\Master_not-normalized.txt' / V1 TO V1530. N 10. COMPUTE CASENUM=$CASENUM. EXECUTE. COMPUTE MAXVAL = MAX(V1 TO V1530). COMPUTE MINVAL = MIN(V1 TO V1530). COMPUTE AVEVAL = SUM(V1 TO V1530)/1530. LIST CASENUM MAXVAL MINVAL AVEVAL. LIST CASENUM V1366 V1367. ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
I would add to Jon's comment:
Using DATA LIST FREE is asking for trouble. If any line of data is missing a value or has an extra value the remaining data will be read incorrectly. Better to use DATA LIST LIST or FIXED...
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
Free forum by Nabble | Edit this page |