<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Parsing CSV data with Alt-Enter separators within one cell in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621165#M18725</link>
    <description>&lt;P&gt;You don't appear to be using TRANSLATE() properly.&amp;nbsp; Did you intend to convert the carriage returns to semi-colons and the linefeeds to spaces?&amp;nbsp; That is what your code is doing.&amp;nbsp; If so it would be better to clearly spell that out in the code by explicitly including the space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;translate(comment,'; ','0D0A'X)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If not then perhaps you wanted the TRANWRD() or TRANSTRN() function instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tranwrd(comment,'0D0A'X,';')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 30 Jan 2020 15:04:50 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2020-01-30T15:04:50Z</dc:date>
    <item>
      <title>Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164924#M3160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Beginner here...&lt;/P&gt;&lt;P&gt;I have a CSV file that requires 2 rounds of parsing, and I cannot figure out how to do it:&lt;/P&gt;&lt;P&gt;1) parse out rows that are all in one cell, currently separated by an Alt-Enter, into their own rows (and cells);&lt;/P&gt;&lt;P&gt;2) parse out comma-separated-values in these new rows into their own columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please refer to the attached JPGs of file as a guide to illustrate what I am trying to accomplish. There are 2 worksheets: “Incoming data” shows what I receive (in CSV format), and “Goal” shows where I need to end up (preferably in Excel format):&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;1. In “Incoming data” worksheet, column E (“Comments”) contains data that is on multiple lines separated by Alt-Enter, but within the same cell. Data in each row within the cell is separated by commas, always in the following order:&lt;/P&gt;&lt;OL style="list-style-type: lower-alpha;"&gt;&lt;LI&gt;GA123456 = invoice number (this alphanumeric value always starts with a GA, QR, QC, or AC. The number of numeric digits after the 2 letters is always 6, and they are always numbers)&lt;/LI&gt;&lt;LI&gt;7 = dispute reason (number can be anywhere between 1 and 25)&lt;/LI&gt;&lt;LI&gt;$71.40 = disputed amount (sometimes with dollar sign, sometimes without. Value can be anywhere from $0.01 to $200000. Value will never be separated by a comma for $thousands)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;2. Column E needs to be parsed out so that each row within cell E2 is in its own cell (and therefore row), and the data in columns A-D and F-I are duplicated to the new rows.&lt;/P&gt;&lt;P&gt;3. Column E then needs to be further parsed out so that each comma separated value is in its own cell, under its new column heading. See worksheet “Goal” in attached file to illustrate my final desired goal.&lt;/P&gt;&lt;P&gt;Whether step 2 comes before 3 or vice versa, I don’t care. As long as the data ends up as per “Goal”, I am happy.&lt;/P&gt;&lt;P&gt;Additional comments on the CSV data file:&lt;/P&gt;&lt;P&gt;1. The CSV file will be ultimately be used in MS Excel 2010 for further processing.&lt;/P&gt;&lt;P&gt;2. The CSV file will be up to 5000 rows long, but the number of columns will stay the same.&lt;/P&gt;&lt;P&gt;3. In the ‘Incoming Data’ Comments column, there could be up to 15 separate rows within one cell, each row separated by an Alt-Enter. This example only shows three.&lt;/P&gt;&lt;P&gt;4. The “Disputed Amount” will undoubtedly be sometimes entered with a $ sign, and sometimes without. I need the macro to work either way.&lt;/P&gt;&lt;P&gt;5. The parsed data as per the “Goal” worksheet should be in Excel format, if possible.&lt;/P&gt;&lt;P&gt;Many thanks to any and all who choose to assist!&lt;/P&gt;&lt;P&gt;Modsavant&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11498i2F95931181F2F785/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Goal.jpg" title="Goal.jpg" /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/11499iC39731C2258DBBC6/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Incoming data.jpg" title="Incoming data.jpg" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 21:54:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164924#M3160</guid>
      <dc:creator>Modsavant</dc:creator>
      <dc:date>2014-11-10T21:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164925#M3161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is your OS and SAS version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Post example of CSV file as attachment.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 22:11:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164925#M3161</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2014-11-10T22:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164926#M3162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh... I assumed when I entered that info into my SAS Profile, it would be automatically visible to others.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OS: Windows 7 Enterprise, 32 bit&lt;/P&gt;&lt;P&gt;SAS: EG 6.1 M1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The system didn't let me upload CSV or Excel, so I posted some screenshots of my data in my original post.&lt;/P&gt;&lt;P&gt;Also, I no longer see an option to attach files at this point.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 22:19:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164926#M3162</guid>
      <dc:creator>Modsavant</dc:creator>
      <dc:date>2014-11-10T22:19:12Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164927#M3163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the advanced editor (upper right hand light text of Reply) to attach sample data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CSV doesn't have "cells", so a sample is required to fully understand what you're talking about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Nov 2014 23:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164927#M3163</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-10T23:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164928#M3164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is because your data contains some line carriage character( i.e.&amp;nbsp; '0D0A'x ).&lt;/P&gt;&lt;P&gt;And better use HEX. check what exactly these special character are .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
id=1; comment=catx('0D0A'x,'saas','sdfsd','xcxd','vdfew');output;
id=2; comment=catx('0D0A'x,'wwe','ghf','bvd','azx');output;
run;
data want;
 set have;
 do i=1 to countw(comment,'0D0A'x);
&amp;nbsp; com=scan(comment,i,'0D0A'x);output;
 end;
 drop i comment;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: xia keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 12:26:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164928#M3164</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-11T12:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164929#M3165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just made a quick check (Win7, Excel 2010).&lt;/P&gt;&lt;P&gt;A spreadsheet with Alt-Enter linebreaks in the cells will, when saved as .csv, have hex 0A as linebreaks in the cells and hex 0D0A as record separator.&lt;/P&gt;&lt;P&gt;Unfortunately, both (0A and 0D0A) are interpreted by SAS to be record separators, so you may need to do some cleaning before reading into SAS, or try to read the file raw:&lt;/P&gt;&lt;P&gt;use recfm=f&lt;/P&gt;&lt;P&gt;read into a buffer variable until you detect a 0D0A sequence&lt;/P&gt;&lt;P&gt;split into fields using the delimiter of the csv&lt;/P&gt;&lt;P&gt;then split the multiple-line cell using 0A as delimiter&lt;/P&gt;&lt;P&gt;output for each item in the multiple-line cell&lt;/P&gt;&lt;P&gt;delete everything from the buffer up to and including the 0D0A&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 13:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164929#M3165</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-11T13:31:36Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164930#M3166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if it helps, but I had some code from Support for dealing with 0D0A characters: &lt;A _jive_internal="true" href="https://communities.sas.com/thread/60374"&gt;https://communities.sas.com/thread/60374&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 13:56:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164930#M3166</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-11T13:56:12Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164931#M3167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Forget my previous posting.&lt;/P&gt;&lt;P&gt;Use&lt;/P&gt;&lt;P&gt;infile "....." termstr=CRLF dlm=';' dsd;&lt;/P&gt;&lt;P&gt;and read the fields. Then split the multiple line cell along the 0A's with the scan function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Caution: Will not work if file is transferred to say, UNIX, as ASCII and the CRLF's are replaced with LF's.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Nov 2014 14:03:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164931#M3167</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-11-11T14:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164932#M3168</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I appreciate everyone's input, but it is clear to me that I need more help here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't even know HOW to implement your suggestions. I was expecting answers that sounded something like "Open the Query Builder and choose such and such an option..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I read:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Use&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;infile "....." termstr=CRLF dlm=';' dsd;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...it tells me that I am in over my head. How would I even start "using" this type of code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use SAS for its easy visual method of building queries. I don't code anything. I may just try to figure out my problem directly in Excel.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 16:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164932#M3168</guid>
      <dc:creator>Modsavant</dc:creator>
      <dc:date>2014-11-20T16:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164933#M3169</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you post sample data someone can help with code. A picture of the data isn't helpful, to provide code someone would have to generate fake data, which in this case is a bit of work, so instead you get ideas of the solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My solution would be a standard import and then parse it out with the scan function because it looks like your data follows a specific structure and you know you have a max amount (15) so it would relatively straight forward.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you choose to do it in Excel/manually look at the Data&amp;gt;Text to Columns feature to separate out the fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck either way &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 16:52:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164933#M3169</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-11-20T16:52:16Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164934#M3170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, sorry.&amp;nbsp; Just assumed you were a SAS programmer, didn't read the Data Management discussion group.&amp;nbsp; If that is the case, I would recommend passing it to your programmers to sort out.&amp;nbsp; Whilst you could do things in Excel, it definately wouldn't be my recommendation.&amp;nbsp; For instance, how would you validate it?&amp;nbsp; not sure of your position, but if that data is used in any kind of important step and there is problems...&amp;nbsp; Your programmers (I would hope) have processes for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 17:04:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164934#M3170</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-11-20T17:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164935#M3171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From your comments, I take it that you have both the Excel xlsx file and a copy saved as a CSV file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your site licenses the product that allows you to import Excel files you could just open a program window, paste the code below, and run it. The only two things you would have to change is where I used datafile="c:\art\test1.xlsx" to be the location and name of your excel workbook and, where I indicated sheet="Sheet1"; to indicate the actual name of the worksheet you have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile="c:\art\test1.xlsx" out=thedata replace dbms=excel;&lt;/P&gt;&lt;P&gt;&amp;nbsp; sheet="Sheet1";&lt;/P&gt;&lt;P&gt;&amp;nbsp; usedate=yes;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=comments i);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set thedata;&lt;/P&gt;&lt;P&gt;&amp;nbsp; i=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (scan(comments,i,'0A'x) ne "");&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Invoice_Number=scan(scan(comments,i,'0A'x),1,',');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dispute_Reason=input(scan(scan(comments,i,'0A'x),2,','),8.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Disputed_Amount=input(scan(scan(comments,i,'0A'x),3,','),comma12.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; i+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Nov 2014 18:55:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/164935#M3171</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-11-20T18:55:43Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621094#M18724</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Thank you for your input here. It really helped and resolved my issue with data export to CSV.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my code which works perfectly to my problem:&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;comment=catx('0D0A'x,'sa as','sdf&amp;nbsp;&amp;nbsp; sd','xcxd','v dfew');&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;id=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;; &lt;/FONT&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;comment=catx('0D0A'x,'w we','ghf','bv d','azx');&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;output&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; want;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* Count number of lines in a cell;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; Cnt=countw(comment,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'0D0A'x&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* Remove line breaks;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; comment_new=compress(comment,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'0D0A'X&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008000" face="Courier New" size="3"&gt;* Remove extra space and connect text in different lines by semicolon;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt; comment_new1=compbl(translate(comment,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;';'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'0D0A'X&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;));&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/35752i1841B540B11E65C1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 09:42:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621094#M18724</guid>
      <dc:creator>Suzy_Cat</dc:creator>
      <dc:date>2020-01-30T09:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621165#M18725</link>
      <description>&lt;P&gt;You don't appear to be using TRANSLATE() properly.&amp;nbsp; Did you intend to convert the carriage returns to semi-colons and the linefeeds to spaces?&amp;nbsp; That is what your code is doing.&amp;nbsp; If so it would be better to clearly spell that out in the code by explicitly including the space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;translate(comment,'; ','0D0A'X)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If not then perhaps you wanted the TRANWRD() or TRANSTRN() function instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tranwrd(comment,'0D0A'X,';')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jan 2020 15:04:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621165#M18725</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-01-30T15:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Parsing CSV data with Alt-Enter separators within one cell</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621366#M18728</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;, the code works perfectly with what I want to achieve.&lt;BR /&gt;Your suggestion help with alternative ways to get the same result.&lt;BR /&gt;Appreciated for your time:)&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Jan 2020 04:31:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Parsing-CSV-data-with-Alt-Enter-separators-within-one-cell/m-p/621366#M18728</guid>
      <dc:creator>Suzy_Cat</dc:creator>
      <dc:date>2020-01-31T04:31:48Z</dc:date>
    </item>
  </channel>
</rss>

