I have recently encountered a dataset which was imported from and Excel file. In that dataset, several free-text fields contain multi-line entries, from what I suspect were texts from long comments or reports that were automatically collected into Excel. Now, I wish to view the contents of each field, and I'm struggling to find a solution that allows word-wrapping and maintains the newline structure from those data.
Some ideas I have tried:
1) View the data in -browse- mode. The drawback here is that in the value field, only text up to the first line-break/new-line character is displayed. In the variable preview area, the text is run together as a single line. There isn't the option to expand either the row height or the value field to see the entire contents.
2) storing the value in a local macro and displaying has two drawbacks: the first is that the data length may exceed that of the local macro, and secondly all data get displayed as if it were a single line.
3) Display one value at a time, directly, using -display var[#]-. This seems the most acceptable solution because at least display will respect line breaks, but it is not so desirable because I can only investigate one observation at a time, and it's not easy to compare this text with or variables for the same observation at the same time.
4) Use -list- or -cl-. This results in truncation to the max width of the results window.
Is there anything I'm missing or do you have any suggestions on how to view long and multi-line string data?
A data example follows.
Code:
clear set obs 1 gen strL x = "This is some text that runs" + char(10) + "over multiple lines" + char(10) + "Aspernatur cumque eum sed ut et illum sit. Rerum sunt vel iusto ex autem et. Repellendus consequatur consequuntur incidunt natus illo qui nemo minima. Voluptatum accusamus quis maxime. Nemo provident consequuntur voluptatem delectus perspiciatis." list x in 1 local x1 = x[1] di "`x1'" di x[1]
0 Response to Viewing multi-line text within string variables
Post a Comment