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: Append the Contents of Fixed Width Text File


From   Steve Samuels <[email protected]>
To   [email protected]
Subject   Re: st: Append the Contents of Fixed Width Text File
Date   Sat, 17 Aug 2013 15:18:30 -0400

Remove the "using filename" phrase from the dictionary. It can also go
in the -infile- statement, as in this example for -help infile2-

. infile using mydict, using(mydata)

Steve

On Aug 17, 2013, at 2:33 PM, Rijo John wrote:

That sounds good. But how will I specify the dictionary file then?
At the moment it starts like

dictionary using f1.txt {
_column(4) var1 %5f
_column(30) var2 %1f
-------------
------------
-----------
}

For the below program to work the dictionary file (dict.dct) should
not contain the file name f1.txt.




On Sat, Aug 17, 2013 at 11:37 PM, Steve Samuels <[email protected]> wrote:
> You say you need to append the files together first.   Why first?
> 
> Something like this should produce the same result.
> 
> . save d1, replace emptyok
> . foreach f in f1 f2 f3 {
> . clear
> . infile using dict.txt, using(`f'.txt).
> . gen source = "`f'"
> . append using d1
> . save d1, replace
> }
> 
> Steve
> 
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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