Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: using infile dictionary


From   Andrzej Niemierko <aniemierko@PARTNERS.ORG>
To   Stata <statalist@hsphsun2.harvard.edu>
Subject   Re: st: using infile dictionary
Date   Fri, 23 Jul 2010 10:06:40 -0400

Thank you, Jon. This is helpful but not exactly what I need. In fact, after
each line of text I have 122 pairs of numbers so it is _lines(123)
structure, and the number of structures is six. However, the real issue is
that those 122 pairs of numbers represent only two variables with 122
observations each. And this repeats six times. The final data structure
should be 6x2=12 columns (variables) with 122 observations each. Any idea
how can this be accomplished?
Andrzej




On 7/22/10 11:22 PM, "Jon Gettman" <jgettman@hughes.net> wrote:

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index