Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: using infile dictionary


From   Jon Gettman <[email protected]>
To   [email protected]
Subject   Re: st: using infile dictionary
Date   Thu, 22 Jul 2010 23:22:49 -0400

The test data file I set up literally uses "one line of text" as the string of text on the first,fifth, and ninth lines. It gets truncated, and if the line of text is not needed in the dataset, this might work. Look at Example 7 in the manual on page 294. Treat the structure as a 4 line data entry. Then delete the first variable when you get the data loaded into Stata.

dictionary using "C:\DATA\test.txt" {
_lines(4)
_line(1)
                str13   xxx             "onelineoftext"
_line(2)
                int     a1              "a1"
                int     a2              "a2"
_line(3
                int     b1              "b1"
                int     b2              "b2"
_line(4)
                int     c1              "c1"
                int     c2              "c2"
}

.infile using "C:\Data\test.dct"

xxx     a1      a2      b1      b2      c1      c2
one     2       4       3       5       5      6
one     1       3       2       7       7      6
one     4       6       2       1       3       5

I hope this helps.  Does this get you what you want?
Jon




At 11:38 AM 7/22/2010, you wrote:
I would appreciate help with -infile dictionary-.

My data files have the following structure:

One line of text
2 4
3 5
5 6
One line of text
1 3
2 7
7 6
One line of text
4 6
2 1
3 5

I want to read this file and create six numerical variables (three pairs)
corresponding to the three sections of numbers below each line of text.
Thank you.
Andrzej





The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index