Hi,
I just cleaned a data in stata and need to write it into .csv, but the data in .csv becomes all weird in terms of formatting.
This is the code I use to export:
This worked better than
where the columns and the entries were all messed up and on top of one another.
However, in the data I obtain from outsheet, I still need to adjust the column width to accommodate values. I cannot do that by opening the csv because (1) the data is too large to fully load in excel and if i save it, I'd be losing observations, and (2) I need to send this csv to some agency for them to perform some linkage and they won't accept the data unless all the columns are of appropriate width.
Is there any way to adjust the column widths while exporting/outsheet -ing to csv from stata? Or any other solution to my problem?
Thanks and I await your response!
I just cleaned a data in stata and need to write it into .csv, but the data in .csv becomes all weird in terms of formatting.
This is the code I use to export:
Code:
outsheet using "$data/data.csv", comma
Code:
export delimited using "$data/data.csv", datafmt replace
However, in the data I obtain from outsheet, I still need to adjust the column width to accommodate values. I cannot do that by opening the csv because (1) the data is too large to fully load in excel and if i save it, I'd be losing observations, and (2) I need to send this csv to some agency for them to perform some linkage and they won't accept the data unless all the columns are of appropriate width.
Is there any way to adjust the column widths while exporting/outsheet -ing to csv from stata? Or any other solution to my problem?
Thanks and I await your response!
Comment