Hi All,
I am using -outsheet- to transfer data as txt files. The file needs to be loaded into a system which requires only one space between the columns. This is because the files need to be fixed with and when they are tab separated, they have multiple spaces between the columns. So the file ends up not being the width we want and all the columns after the first one do not have the required start and end positions. ------------------------------------- For instance, what I have is: 1001 1002 1003 1004 1005 What I need is: 1001 1002 1003 1004 1005 ------------------------------------- Is there a way to define a tab as being one space? Or, is there another way to accomplish this goal of one space between columns in a txt files with Stata or Stat/Transfer(I have that too)? Thanks so much everyone, -Prash. * * 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/ |
-help outsheet- says to try the option delimiter("char")
e.g., outsheet using "filename.txt", delimiter(" ") On Tue, Dec 9, 2008 at 9:19 AM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. > > ------------------------------------- > > For instance, what I have is: > > 1001 1002 1003 1004 1005 > > What I need is: > > 1001 1002 1003 1004 1005 > ------------------------------------- > > Is there a way to define a tab as being one space? Or, is there another > way to accomplish this goal of one space between columns in a txt files > with Stata or Stat/Transfer(I have that too)? > > Thanks so much everyone, > > -Prash. > > > * > * 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/ > -- Dan Weitzenfeld Media Analyst EmSense Corporation 512 2nd Street, 3rd Floor San Francisco, CA 94107 w: 415.418.7314 m: 510.552.0106 [hidden email] * * 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/ |
Thanks a bunch Dan! That works.
-Prash. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Dan Weitzenfeld Sent: Tuesday, December 09, 2008 10:33 AM To: [hidden email] Subject: Re: st: outsheet txt files with one space between columns -help outsheet- says to try the option delimiter("char") e.g., outsheet using "filename.txt", delimiter(" ") On Tue, Dec 9, 2008 at 9:19 AM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. > > ------------------------------------- > > For instance, what I have is: > > 1001 1002 1003 1004 1005 > > What I need is: > > 1001 1002 1003 1004 1005 > ------------------------------------- > > Is there a way to define a tab as being one space? Or, is there > way to accomplish this goal of one space between columns in a txt files > with Stata or Stat/Transfer(I have that too)? > > Thanks so much everyone, > > -Prash. > > > * > * 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/ > -- Dan Weitzenfeld Media Analyst EmSense Corporation 512 2nd Street, 3rd Floor San Francisco, CA 94107 w: 415.418.7314 m: 510.552.0106 [hidden email] * * 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/ |
In reply to this post by Dan Weitzenfeld
I just tried using -outsheet- with the -char(" ")- option, however, this produces in some cases data field separated by more than one space, too. I have no solution to your problem, but maybe it would be a good workaround to -outfile- your data using the -comma- option. Having done so, open the new file with an editor of your choice, replace every instance of repeated commas (e.g. ",,,,,") by one single space first and then replace the remaining instance of only one comma with one space, too.
Hope this helps, Jochen ------------------------------------------------------------------------------------------- Jochen Späth Dipl.-Volkswirt Institut für Angewandte Wirtschaftsforschung (IAW) Tübingen Ob dem Himmelreich 1 72074 Tübingen Tel.: +49-(0)7071-9896-14 Fax: +49-(0)7071-9896-99 EMail: [hidden email] IAW-Homepage: www.iaw.edu ------------------------------------------------------------------------------------------- -----Ursprüngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Dan Weitzenfeld Gesendet: Dienstag, 9. Dezember 2008 18:33 An: [hidden email] Betreff: Re: st: outsheet txt files with one space between columns -help outsheet- says to try the option delimiter("char") e.g., outsheet using "filename.txt", delimiter(" ") On Tue, Dec 9, 2008 at 9:19 AM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. > > ------------------------------------- > > For instance, what I have is: > > 1001 1002 1003 1004 1005 > > What I need is: > > 1001 1002 1003 1004 1005 > ------------------------------------- > > Is there a way to define a tab as being one space? Or, is there another > way to accomplish this goal of one space between columns in a txt files > with Stata or Stat/Transfer(I have that too)? > > Thanks so much everyone, > > -Prash. > > > * > * 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/ > -- Dan Weitzenfeld Media Analyst EmSense Corporation 512 2nd Street, 3rd Floor San Francisco, CA 94107 w: 415.418.7314 m: 510.552.0106 [hidden email] * * 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/ |
In reply to this post by Prashant Shukla
Prashant Shukla <[hidden email]>
For fixed width output, try ssc inst outfixt On Tue, Dec 9, 2008 at 12:19 PM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. * * 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/ |
In reply to this post by Jochen Späth
Thanks Jochen.
Yes, now I notice it too. I think -outsheet- with -char(" ")- option produces columns separated by more than one space when we have blank column. Now a new problem arises here, a blank column formatted as a string of length, say 5, still appears as only one space instead of 5. Do I need to manually set the blank columns to be equal to " "? I will try -outfile- using the -comma- option and see how that goes. Thanks again, -Prash. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Jochen Späth Sent: Tuesday, December 09, 2008 10:47 AM To: [hidden email] Subject: AW: st: outsheet txt files with one space between columns I just tried using -outsheet- with the -char(" ")- option, however, this produces in some cases data field separated by more than one space, too. I have no solution to your problem, but maybe it would be a good workaround to -outfile- your data using the -comma- option. Having done so, open the new file with an editor of your choice, replace every instance of repeated commas (e.g. ",,,,,") by one single space first and then replace the remaining instance of only one comma with one space, too. Hope this helps, Jochen ------------------------------------------------------------------------------------------- Jochen Späth Dipl.-Volkswirt Institut für Angewandte Wirtschaftsforschung (IAW) Tübingen Ob dem Himmelreich 1 72074 Tübingen Tel.: +49-(0)7071-9896-14 Fax: +49-(0)7071-9896-99 EMail: [hidden email] IAW-Homepage: www.iaw.edu ------------------------------------------------------------------------------------------- -----Ursprüngliche Nachricht----- Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Dan Weitzenfeld Gesendet: Dienstag, 9. Dezember 2008 18:33 An: [hidden email] Betreff: Re: st: outsheet txt files with one space between columns -help outsheet- says to try the option delimiter("char") e.g., outsheet using "filename.txt", delimiter(" ") On Tue, Dec 9, 2008 at 9:19 AM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. > > ------------------------------------- > > For instance, what I have is: > > 1001 1002 1003 1004 1005 > > What I need is: > > 1001 1002 1003 1004 1005 > ------------------------------------- > > Is there a way to define a tab as being one space? Or, is there another > way to accomplish this goal of one space between columns in a txt files > with Stata or Stat/Transfer(I have that too)? > > Thanks so much everyone, > > -Prash. > > > * > * 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/ > -- Dan Weitzenfeld Media Analyst EmSense Corporation 512 2nd Street, 3rd Floor San Francisco, CA 94107 w: 415.418.7314 m: 510.552.0106 [hidden email] * * 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/ |
In reply to this post by Austin Nichols
Thanks Austin, -outfixt- seems really cool and fitting for my situation.
I will check it out soon. -Prash. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Austin Nichols Sent: Tuesday, December 09, 2008 10:54 AM To: [hidden email] Subject: Re: st: outsheet txt files with one space between columns Prashant Shukla <[hidden email]> For fixed width output, try ssc inst outfixt On Tue, Dec 9, 2008 at 12:19 PM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. * * 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/ |
In reply to this post by Austin Nichols
Hi Austin,
As I am using -outfixt- I realize that I need to specify all the columns again in the command with the -format- option in addition to writing all the variables under the -varlist- option. Since, I already have all the variables named, aligned, and formatted correctly in my dataset; and I am dealing with as many as 300 variables in one dataset, is there a way to avoid using these options and just select all the variables by default and use the same format as I have specified in the program? This would be huge for me. Also, I am using a path and a file name inside quotations to export the file to the desired location. The command displays the dataset in the output window, with breaks, which is not the intention. And the full file is not exported either. I think only the portion of dataset that the output window can accommodate before the first break is being exported. What am I doing wrong? -Prash. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Austin Nichols Sent: Tuesday, December 09, 2008 10:54 AM To: [hidden email] Subject: Re: st: outsheet txt files with one space between columns Prashant Shukla <[hidden email]> For fixed width output, try ssc inst outfixt On Tue, Dec 9, 2008 at 12:19 PM, Prashant Shukla <[hidden email]> wrote: > Hi All, > > I am using -outsheet- to transfer data as txt files. The file needs to > be loaded into a system which requires only one space between the > columns. This is because the files need to be fixed with and when they > are tab separated, they have multiple spaces between the columns. So the > file ends up not being the width we want and all the columns after the > first one do not have the required start and end positions. * * 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/ |
Free forum by Nabble | Edit this page |