|
Is there an SPSS equivalent to the SAS obs= that I can use in Data List? I have a raw fixed width file that has several hundred thousand cases that I would like to bring in just a hundred or so cases initially to test my code.
Thanks, John, Charleston, SC |
|
At 02:50 PM 3/19/2007, John Welton wrote:
>Is there an SPSS equivalent to the SAS obs= that I can use in Data >List? I have a raw fixed width file that has several hundred thousand >cases that I would like to bring in just a hundred or so cases >initially to test my code. I think the separate command N OF CASES 100. after the DATA LIST will do your job; that is, I believe SPSS ends input as soon as the N OF CASE is satisfied. This is SPSS 15 draft output <WRR-not saved separately>: NEW FILE. DATA LIST FIXED SKIP=2 / Date 05-23 (DATETIME) patientid 31-32 (F) userid 44-45 (F) dose 50-53 (F). Data List will read 1 records from the command file Variable Rec Start End Format Date 1 5 23 Datetime19.0 patientid 1 31 32 F2.0 userid 1 44 45 F2.0 dose 1 50 53 F4.0 N OF CASES 5. BEGIN DATA Date patientid userid dose ----|---10----|---20----|---30----|---40----|---50----| 01/01/2006 08:20:13 01 20 .2 01/01/2006 08:20:15 01 20 .2 01/01/2006 08:20:16 01 20 .2 01/01/2006 08:20:18 01 20 .2 01/01/2006 08:20:19 01 20 .2 01/01/2006 08:23:18 01 20 .5 01/01/2006 08:23:29 01 20 .5 01/01/2006 08:23:22 01 20 .5 01/01/2006 08:20:17 02 21 .6 01/01/2006 08:20:19 02 21 .6 01/01/2006 08:20:20 02 21 .6 END DATA. LIST. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 17:07:34 | |-----------------------------|---------------------------| Date patientid userid dose 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 Number of cases read: 5 Number of cases listed: 5 |
|
I could never figure it out... in sas all you say (obs=5) in the data
statement. Fermin Ornelas, Ph.D. Management Analyst III, AZ DES Tel: (602) 542-5639 E-mail: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow Sent: Monday, March 19, 2007 2:10 PM To: [hidden email] Subject: Re: SPSS equivalent to SAS obs= At 02:50 PM 3/19/2007, John Welton wrote: >Is there an SPSS equivalent to the SAS obs= that I can use in Data >List? I have a raw fixed width file that has several hundred thousand >cases that I would like to bring in just a hundred or so cases >initially to test my code. I think the separate command N OF CASES 100. after the DATA LIST will do your job; that is, I believe SPSS ends input as soon as the N OF CASE is satisfied. This is SPSS 15 draft output <WRR-not saved separately>: NEW FILE. DATA LIST FIXED SKIP=2 / Date 05-23 (DATETIME) patientid 31-32 (F) userid 44-45 (F) dose 50-53 (F). Data List will read 1 records from the command file Variable Rec Start End Format Date 1 5 23 Datetime19.0 patientid 1 31 32 F2.0 userid 1 44 45 F2.0 dose 1 50 53 F4.0 N OF CASES 5. BEGIN DATA Date patientid userid dose ----|---10----|---20----|---30----|---40----|---50----| 01/01/2006 08:20:13 01 20 .2 01/01/2006 08:20:15 01 20 .2 01/01/2006 08:20:16 01 20 .2 01/01/2006 08:20:18 01 20 .2 01/01/2006 08:20:19 01 20 .2 01/01/2006 08:23:18 01 20 .5 01/01/2006 08:23:29 01 20 .5 01/01/2006 08:23:22 01 20 .5 01/01/2006 08:20:17 02 21 .6 01/01/2006 08:20:19 02 21 .6 01/01/2006 08:20:20 02 21 .6 END DATA. LIST. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 17:07:34 | |-----------------------------|---------------------------| Date patientid userid dose 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 Number of cases read: 5 Number of cases listed: 5 NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR CONFIDENTIAL information and is intended only for the use of the specific individual(s) to whom it is addressed. It may contain information that is privileged and confidential under state and federal law. This information may be used or disclosed only in accordance with law, and you may be subject to penalties under law for improper use or further disclosure of the information in this e-mail and its attachments. If you have received this e-mail in error, please immediately notify the person named above by reply e-mail, and then delete the original e-mail. Thank you. |
|
Will that approach work in earlier versions of SPSS, such as version 10?
Bruno Berszoner Tufts Health Plan Quality and Health Informatics (617) 923-5868 x4393 "Ornelas, Fermin" <FOrnelas2@azdes. gov> To Sent by: [hidden email] "SPSSX(r) cc Discussion" <SPSSX-L@LISTSERV Subject .UGA.EDU> Re: SPSS equivalent to SAS obs= 03/19/2007 06:25 PM Please respond to "Ornelas, Fermin" <FOrnelas2@azdes. gov> I could never figure it out... in sas all you say (obs=5) in the data statement. Fermin Ornelas, Ph.D. Management Analyst III, AZ DES Tel: (602) 542-5639 E-mail: [hidden email] -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Richard Ristow Sent: Monday, March 19, 2007 2:10 PM To: [hidden email] Subject: Re: SPSS equivalent to SAS obs= At 02:50 PM 3/19/2007, John Welton wrote: >Is there an SPSS equivalent to the SAS obs= that I can use in Data >List? I have a raw fixed width file that has several hundred thousand >cases that I would like to bring in just a hundred or so cases >initially to test my code. I think the separate command N OF CASES 100. after the DATA LIST will do your job; that is, I believe SPSS ends input as soon as the N OF CASE is satisfied. This is SPSS 15 draft output <WRR-not saved separately>: NEW FILE. DATA LIST FIXED SKIP=2 / Date 05-23 (DATETIME) patientid 31-32 (F) userid 44-45 (F) dose 50-53 (F). Data List will read 1 records from the command file Variable Rec Start End Format Date 1 5 23 Datetime19.0 patientid 1 31 32 F2.0 userid 1 44 45 F2.0 dose 1 50 53 F4.0 N OF CASES 5. BEGIN DATA Date patientid userid dose ----|---10----|---20----|---30----|---40----|---50----| 01/01/2006 08:20:13 01 20 .2 01/01/2006 08:20:15 01 20 .2 01/01/2006 08:20:16 01 20 .2 01/01/2006 08:20:18 01 20 .2 01/01/2006 08:20:19 01 20 .2 01/01/2006 08:23:18 01 20 .5 01/01/2006 08:23:29 01 20 .5 01/01/2006 08:23:22 01 20 .5 01/01/2006 08:20:17 02 21 .6 01/01/2006 08:20:19 02 21 .6 01/01/2006 08:20:20 02 21 .6 END DATA. LIST. List |-----------------------------|---------------------------| |Output Created |19-MAR-2007 17:07:34 | |-----------------------------|---------------------------| Date patientid userid dose 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 01-JAN-2006 08:20 1 20 0 Number of cases read: 5 Number of cases listed: 5 NOTICE: This e-mail (and any attachments) may contain PRIVILEGED OR CONFIDENTIAL information and is intended only for the use of the specific individual(s) to whom it is addressed. It may contain information that is privileged and confidential under state and federal law. This information may be used or disclosed only in accordance with law, and you may be subject to penalties under law for improper use or further disclosure of the information in this e-mail and its attachments. If you have received this e-mail in error, please immediately notify the person named above by reply e-mail, and then delete the original e-mail. Thank you. |
|
At 09:07 AM 3/20/2007, Bruno Berszoner wrote:
>Will [using N OF CASES] work in earlier versions of SPSS, such as >version 10? Yes. N OF CASES has been in SPSS at least since version 6 for the mainframe (NOT version 6 for Windows), around 1975. At that point, there was no equivalent of the BEGIN DATA/END DATA syntax. N OF CASES was required, and had to be exact, when reading data on cards (yes, punched Hollerith cards) included in the SPSS deck. The version 6 for mainframe documentation (the "maroon manual") doesn't seem to mention using N OF CASES to read only the first part of a file, but that effect probably existed then. |
| Free forum by Nabble | Edit this page |
