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

Re: st: Convert a packed file to ASCII


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Convert a packed file to ASCII
Date   Fri, 30 Jul 2004 12:47:39 -0400

At 11:40 AM 7/30/2004 -0400, Steve Barsby wrote:
Our IT dept. started with the following file:
DORS.. . .TESTBS.S.AND.DB2DATA  LRECL=112

The next command I saw was:
Transfer to h:. . . .\(filename).txt

The 1st three fields of 24 look like this:
001  ID_DLN               DEC(13,0)                  1 packed 7
002 CD_TYPE_ID        DEC(3,0)                    8 packed 2
003 ID_ENTITY           Char(11)                   10

So, the 1st field is a 13-character decimal # with 0 decimal points
packed down to 7
the 2nd field is a 3-character decimal # with 0 decimal points
beginning in position 8 packed down to 2
the 3rd field is an 11-character character field with 11 characters
beginning in position 10
etc.
all in all, 112 positions are taken by the file in this mixed format.

IT tells me it's a BIG DEAL for them to program to get an ASCII file I
can read directly.  Is there a way to deal with this mixed file with a
.txt extension so I can get it into STATA?
Thanks
Steve
[...]
I would try to read it using SAS, using the PDw.d informat (or maybe PKw.d if it is meant to be unsigned). Then Stat/transfer the result to stata.

But then again, in want form did it start? -- assuming your IT dept transferred from something to text (or mixed text/packed-decimal). Maybe you can Stat/transfer it directly.

I hope this helps.
-- David

David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404

*
* 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