Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Problem with Dictionary File


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: Problem with Dictionary File
Date   Wed, 6 Jun 2007 14:19:31 -0400

This is really unclear--can you provide an example of a few lines of
code that duplicates the problem using -sysuse auto- as your starting
point?

Note that in general you can read in hierarchical files, with data
measured at various levels, in one dictionary file, and then "clean
up" the data with a do-file.  See the US Current Population Survey for
an example:
http://www.nber.org/data/cps_progs.html


On 6/6/07, krishanu karmakar <[email protected]> wrote:
Dear Stata User Friends,

I have recently encountered a peculiar problem while trying to extract
fixed format data using a dictionary file. Any focus on the problem
will be welcome. The problem is as follows (I am putting things point
wise):
1. As stated above I am trying to extract some fixed format data from
a .txt file.
2. There were 16 "levels" (or 16 different "sets of questions"). So I
have to use 16 different dictionary files to extract the data relevant
for each level and drop all observations execpt for the level for
which the current dictionary file has been written (using keep if
level=="01" after using the dictionary file for level 1 and so on).
this gives me 16 .dta datasets each partaining to one "level".
3. now each data set has some number of variables which generally
start with a few identifiers and then some
actual data and then some more identifiers.
4. Now comes the problem. while writing the dictionary file I am
specifying the storage type of the identifiers as str#. then some of
the other variables have str# or numeric (byte, float etc) storage
format. ALong with this I am also
Specifying the %infmt as %#s or %#f accordingly. Where # is the
relevant integer which may be 1, 2, or any other integer. But the
PROBLEM is STATA is reading all the variables with a # in the %infmt
greater than or equal to 9. i.e for all the specifications (by me) %1
or 2 or ....8s or f Stata is reading them as %9s or f and sometimes
even as %9g. But for any # in %#s or f that I specified to be greater
than 9 Stata is reading it as I have written. Why is Stata defying the
instructions for #<9?

Any Help will be welcome

Thanking you
Krishanu
*
*   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