Hello,
I was hoping for any ideas on the combination of two or more data sets when exporting to txt that have different fields and lengths. A variety of requests that we receive include uploading txt files where the overall row lengths change from line to line and where the delimiter shifts positions based on field length. Traditionally we have just output the different txt files and manually combined them (copy+paste the second txt file into the body of the first under the last line of the first txt file).
Example of the fake data txt file output lines with the data steps for export:
data export_1; set part_a_txt; file "\\filepath.txt" dlm=','; put id $13. survey $9. section $10. code $16. line $8. race $7. sex $6. count $11.; run;
data export_2; set part_b_txt; file "\\filepath.txt" dlm=','; put id $13. survey $9. section $10. level $8. line $8. sex $6. count $11.; run;
Resulting txt file 1: ID=######,SURVEY=1,SECTION=1,CODE=13.0000,LINE=11,RACE=2,SEX=1,COUNT=2
Resulting txt file 2: ID=######,SURVEY=1,SECTION=2,LEVEL=1,LINE=01,SEX=1,COUNT=2
Does anyone know of a way that I could essentially combine the two data steps here that I am using for a single data export step despite the fields and the overall line length being different? I understand I that I could probably just concatenate all of this together into one field, union, and export that way, but I wouldn't call that the most ideal way of handling it and I'm curious if others have any ideas.
I appreciate any advice you have to offer. Thanks.
Evan
... View more