Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: IMPS--.WGT file


From   SamL <[email protected]>
To   [email protected]
Subject   Re: st: IMPS--.WGT file
Date   Wed, 7 Jul 2004 13:10:33 -0700 (PDT)

I am not sure if one can figure out data formats easily by checking the
datafile and the dictionary.  Sometimes it works, but with large files
seems kind of risky.  Our version of stat/transfer does not seem to work
with the WGT filetype.  You might download the software from the census
site, read in the data using that package, then write it out (if possible)
into ASCII.

I know this is the long way around, and I know it depends on being able to
use the IMPS software to write out ASCII files (something I don't know
whether it can do for sure), but if those pieces fall into place it should
be easy.  If it cannot write out ASCII, it may write out in some other
format that stat/transfer can read.

You may find the software to download at

http://www.census.gov/ipc/www/imps/

Hope this helps.
Sam

On Wed, 7 Jul 2004, Amit Khandelwal wrote:

> I have a .WGT file that was created by IMPS (Integrated Microcomputer
> Processing System). I believe it is an program used by the Census Bureau.
> I have not been able to figure out how to read the file. I have the
> dictionary file generated by the program (see bottom of this email for
> what it looks like). I am trying to read it into STATA using a dictionary
> (again, see bottom of this email for my dictionary file), but it doesn't
> appear to be reading the data properly. There are 19 records, across 64
> lines for each household. Viewing the data in word gives something
> like this:
>
> 01221003010021550304071222105671330025101502
> 2                          2
> 022210030100215503040712221056713311000751011220000000000150051299 2
> 0222100301002155030407122210567133220002511412200000000000111511141
> 0222100301002155030407122210567133210005010112100000000001400512  1
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 02221003010021550304071222105671338
> 03221003010021550304071222105671330101012              2                2
> 01012               000000000000000000000000000000000000000101012
> 2               2                01012              2              2
> 1  000015000015201
>
> where the first two columns are the record number (so, here there is one
> record #1, twelve record #2, one record #3).
>
> The IMPS generated dictionary file looks like this (a sample)
>
> Page    1                Data Dictionary: PHSW9596              IMPS
> Version 3.1
>                         Created: 25/03/98  10:32:08
>
>                         Record Length:      306
>
>     The following records have been defined:
>
>     Record             Record Type Value                        Max.
>     Name                   (RECTYPE)            Required        Records
>     ------              -----------------       --------        -------
>     REC1-FARM-LAND              01                  N              1
>     REC1A-FARM-LAND             02                  N              12
>     REC2-CROP-PROD              03                  N              6
>     REC3-CASSAVA                04                  N              1
>     REC4A-LIVE-PROD             05                  N              1
>     REC4B-LIVE-PROD             06                  N              7
>     REC4C-OTHER-LSTK            07                  N              3
>     REC5-DONKEYS                08                  N              1
>     REC6-CHICKS                 09                  N              4
>     REC7-FISH-FARMIN            10                  N              1
>     REC8-PERM-EMPLO             11                  N              1
>     REC9-ASSET-INVES            12                  N              5
>     REC10-DRAUGHT-AN            13                  N              1
>     REC11-CREDITS               14                  N              2
>     REC11A-CREDIT96             15                  N              1
>     REC12-EXT-SERVIC            16                  N              1
>     REC13-SECTION9              17                  N              1
>     REC14-MARKT-INFO            18                  N              1
>     REC15-OTHER-INFO            19                  N              1
>
> The following COMMON items have been defined.  They occur on all records.
> --------------------------------------------------------------------------------
> Item (occurs)        Data            Item
>  Subitem (occurs)   Type  Position  Len.      Value Name       Values
> --------------------------------------------------------------------------------
>
> (record type)          A       1-2      2
>
> D001-PROV              N       3        1      central          1
>                                               copperbelt       2
>                                               eastern          3
>                                               luapula          4
>                                               lusaka           5
>                                               northern         6
>                                               nwestern         7
>                                               southern         8
>                                               western          9
>
> D002-DIST              N       4-5      2      central          11:15
>                                               Copperbelt       21:27
>                                               eastern          31:36
>                                               luapula          41:45
>                                               lusaka           51:53
>                                               northern         61:69
>                                               nwestern         71:76
>                                               southern         81:89
>                                               western          91:96
>
> Page    2                Data Dictionary: PHSW9596              IMPS
> Version 3.1
>                         Created: 25/03/98  10:32:08
>
> The following COMMON items have been defined.  They occur on all records.
> --------------------------------------------------------------------------------
> Item (occurs)        Data            Item
>  Subitem (occurs)   Type  Position  Len.      Value Name       Values
> --------------------------------------------------------------------------------
>
> D003-CSA               N       6-8      3
>
> D004-SEA1              N       9        1
>
> D005-SEA2              N      10        1      sea2             1:6
>
> D006-HHOLD             N      11-13     3
>
> D007-SEX               N      14        1      Male             1
>
>
> My dictionary file I've written is:
> dictionary using belt.WGT {
> _lines(14)
> _line(1) _column(1) rec %2f
> _line(1) _column(3) prov %1f
> _line(1) _column(4) dist %2f
> _line(1) _column(6) csa %3f
> _line(1) _column(9)  sea %1f
> _line(1) _column(10)  sea2 %1f
> _line(1) _column(11)  hh %3f
> _line(1) _column(14)  id1a %1f
> _line(1) _column(15)  id1b %2f
> _line(1) _column(17)  totmale %2f
> _line(1) _column(19)  totfemale %2f
> _line(1) _column(21)  totalpop %2f
> _line(1) _column(23)  id5a %1f
> _line(1) _column(24)  id5b %1f
> _line(1) _column(25)  id5c %1f
> _line(1) _column(26)  id5d %1f
> _line(1) _column(27)  id3 %1f
> _line(1) _column(28)  wgt %7f
> _line(1) _column(35)  totarea %4f
> _line(1) _column(39)  lan1 %1f
> _line(1) _column(40)  totareacp %4f
> _line(1) _column(44)  usefert %1f
> _line(1) _column(45)  basalkg %5f
> _line(1) _column(50)  topkg %5f
> _line(1) _column(55)  anypurch %1f
> _line(1) _column(56)  basalcash %4f
> _line(1) _column(61)  basalkind %4f
> _line(1) _column(66)  topcash %4f
> _line(1) _column(71)  topkind %4f
> _line(1) _column(76)  bsalvalcash %5f
> _line(1) _column(82)  bsalvalkind %6f
> _line(1) _column(88)  topvalcash %6f
> _line(1) _column(94)  topvalkind %6f
> _line(1) _column(100)  basalqty %5f
> _line(1) _column(105)  topqty %5f
> _line(1) _column(110)  valfert %6f
> _line(1) _column(116)  basaltra %6f
> _line(1) _column(122)  toptrans %6f
> _line(1) _column(128)  basalava %1f
> _line(1) _column(129)  topavail %1f
> _line(2) _column(35) parcel %1f
> _line(2) _column(36) field %1f
> _line(2) _column(37) fieldarea %5f
> _line(2) _column(42) cultmethd %1f
> _line(2) _column(43) cropgrwn %2f
> _line(2) _column(48) basalapp %4f
> _line(2) _column(52) topapp %4f
> _line(2) _column(56) fieldrod %6f
> _line(2) _column(62) unit %1f
> _line(2) _column(63) soilfert %1f
> _line(2) _column(64) manure %1f
> _line(2) _column(65) cropgrwn1 %2f
> _line(2) _column(67) notuse %1f
> _line(2) _column(68) mulching %1f
> _line(2) _column(69) contour %1f
> _line(2) _column(70) fallowing %1f
> _line(2) _column(71) terracing %1f
> _line(2) _column(72) bunding %1f
> _line(2) _column(73) other %1f
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _newline
> _line(14) _column(35) crop %2f
> _line(14) _column(37) lan5m %2f
> _line(14) _column(39) lan5f %2f
> _line(14) _column(41) lan6 %1f
> _line(14) _column(42) lan7a %7f
> _line(14) _column(49) lan7b %7f
> _line(14) _column(56) lan8 %1f
> _line(14) _column(57) lan9 %1f
> _line(14) _column(58) lan10 %1f
> _line(14) _column(59) lan11a %7f
> _line(14) _column(66)  lan11b %7f
> _line(14) _column(73) lan12 %1f
> _line(14) _column(74) lan13 %1f
> _line(14) _column(75)  lan14 %1f
> _line(14) _column(76) lan15a %7f
> _line(14) _column(83)  lan15b %7f
> _line(14) _column(90)  pla1m %2f
> _line(14) _column(92) pla1f %2f
> _line(14) _column(94) pla2 %1f
> _line(14) _column(95) pla3a %7f
> _line(14) _column(102) pla3b %7f
> _line(14) _column(109) pla13a %3f
> _line(14) _column(112) pla13b %6f
> _line(14) _column(118)  pla14a %3f
> _line(14) _column(121) pla14b %6f
> _line(14) _column(127) pla15a %3f
> _line(14) _column(130) pla15b %6f
> _line(14) _column(136)  pla16a %6f
> }
>
> But it's not reading into stata correctly. Can anyone offer any advice?
> Thanks.
>
> Amit
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index