My goal is to create a flat .txt file (a file with no delimiter where variables are defined by character positions) for another person who does not use Stata. This person has been given similar files from my agency in the past, but not from me personally. I am trying to replicate the format of those files as best I can. I am trying to minimize the amount of code that the person to whom I am sending this file will have to change when they read the file I intend to send.
My problem is that in the past they have received flat files without blank space between variables, and I am unable to replicate this situation in Stata.
I am using the -outfile- command (with the wide and noquote options) to create the flat file.
Below is an example of my code (using auto data), and infix code that could be used to import the output file. As you can see in the -infix- code there are two blank spaces between each variable.
My actual data contain both numeric and string variables.
Is there a way to create a flat file that does not contain these two blank spaces between each variable?
Thank you,
Jack
My problem is that in the past they have received flat files without blank space between variables, and I am unable to replicate this situation in Stata.
I am using the -outfile- command (with the wide and noquote options) to create the flat file.
Below is an example of my code (using auto data), and infix code that could be used to import the output file. As you can see in the -infix- code there are two blank spaces between each variable.
My actual data contain both numeric and string variables.
Code:
sysuse auto,clear outfile * using "auto.txt", wide noquote
Code:
infix str make 1 - 18 /// price 21 - 28 /// mpg 31 - 38 /// rep78 41 - 48 /// headroom 51 - 56 /// trunk 59 - 66 /// weight 69 - 76 /// length 79 - 86 /// turn 89 - 96 /// displacement 99 - 106 /// gear_ratio 109 - 114 /// foreign 117 - 124 /// using "auto.txt", clear
Thank you,
Jack