|
Hi Listers,
I am working on National Sample Survey Data (NSSO) data of India. In the latest (round) data given in a format which is overlappling in colums. The condition is given for separation and instruction given for generating data set. Let me illustrate my problem From the desciption, the layout of the ascii text file is given as below Sl.No. Item Blk Col Byte Position 1 "Centre code,Round and Shift" 3 1 - 3 2 Filler 1 5 36 - 40 3 Serial no. 4 2 39 - 40 4 Informant Sl.No. 1 2 41 - 42 5 Relation to head 4 1 41 - 41 6 Sex 4 1 42 - 42 7 Response Code 1 1 43 - 43 8 Age 4 3 43 - 45 In the red marked (Bold) line the sequence of items are given as serial number, variable name / label, block number ( an indicator variable), Column position of the data (separated by "-"). Now the the values of the variables are read using the column position indicated. Here in our case the variables have to be read according to the information given in the block position. For example if the value comes in the block number ( variable) is 1 then the value comes in the column 41 to 42 have to be read as the value for "informats serial number" ( a variable) Otherwise if the value comes in the block number (variable) is 4 then the value comes in the column 41 has to be read as the value for "relation to head" (variable) and the value comes in the column 42 has to be read as value for "sex" ( variable). So my question is is it possible to write the code to include this information while reading the data file. with regards pushparaj |
|
What you are looking for is an INPUT PROGRAM. It has very flexible ways of reading (and rereading) lines of text, so it is easy to read a line to find the format type and then reread that line according to the type.
This is syntax only - not in the menus. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion on behalf of s_pushparaj Sent: Sat 7/21/2007 9:33 AM To: [hidden email] Subject: [SPSSX-L] problem in reading ascii data file Hi Listers, I am working on National Sample Survey Data (NSSO) data of India. In the latest (round) data given in a format which is overlappling in colums. The condition is given for separation and instruction given for generating data set. Let me illustrate my problem From the desciption, the layout of the ascii text file is given as below Sl.No. Item Blk Col Byte Position 1 "Centre code,Round and Shift" 3 1 - 3 2 Filler 1 5 36 - 40 3 Serial no. 4 2 39 - 40 4 Informant Sl.No. 1 2 41 - 42 5 Relation to head 4 1 41 - 41 6 Sex 4 1 42 - 42 7 Response Code 1 1 43 - 43 8 Age 4 3 43 - 45 In the red marked (Bold) line the sequence of items are given as serial number, variable name / label, block number ( an indicator variable), Column position of the data (separated by "-"). Now the the values of the variables are read using the column position indicated. Here in our case the variables have to be read according to the information given in the block position. For example if the value comes in the block number ( variable) is 1 then the value comes in the column 41 to 42 have to be read as the value for "informats serial number" ( a variable) Otherwise if the value comes in the block number (variable) is 4 then the value comes in the column 41 has to be read as the value for "relation to head" (variable) and the value comes in the column 42 has to be read as value for "sex" ( variable). So my question is is it possible to write the code to include this information while reading the data file. with regards pushparaj |
| Free forum by Nabble | Edit this page |
