<?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: weird sign ( &amp;quot; ) appearing after Data Exported into csv in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658237#M197275</link>
    <description>&lt;P&gt;Below code changing your .csv directly without reading the data into a SAS table won't perform as good as when using tranwrd(). What it does though is ensure that you only change 99999999 in the selected columns.&lt;/P&gt;
&lt;P&gt;In the regular expression used&amp;nbsp;&lt;CODE class=" language-sas"&gt;^(([^\|]*\|){&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;})(9{8}\|)&lt;/CODE&gt;&amp;nbsp;the number in red represents the number of columns before the one where you want to change the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create sample file */
filename mycsv temp;
data _null_;
  file mycsv;
  put 'abc|def|99999999|1234|99999999|xyx';
  put '99999999|def|78654||99999999|xyx|99999999|abc';
  stop;
run;

/* change 99999999 to 0 if in columns 3 or 5 */
data _null_;
  file print;
  infile mycsv lrecl=32767;
  input;
  put 'Before: ' _infile_;
  _infile_= prxchange('s/^(([^\|]*\|){2})(9{8}\|)/${1}0|/oi', 1, trim(_infile_));
  _infile_= prxchange('s/^(([^\|]*\|){4})(9{8}\|)/${1}0|/oi', 1, trim(_infile_));
  put 'After:  ' _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1592019032428.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42902i7E67B18A7D271D66/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1592019032428.png" alt="Patrick_0-1592019032428.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 13 Jun 2020 03:34:34 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2020-06-13T03:34:34Z</dc:date>
    <item>
      <title>weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658071#M197214</link>
      <description>&lt;P&gt;hi everyone,&lt;/P&gt;&lt;P&gt;i have a huge data set in csv. that has 5mil lines with 332 columns&lt;/P&gt;&lt;P&gt;i have 2 things i want to do with it&lt;/P&gt;&lt;P&gt;1) i want to zeroise the 2 date columns from 99999999 to 0&lt;/P&gt;&lt;P&gt;2) save to csv after step 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hence first i use SAS enterprise Guide 7.1 (64-bits) to import the data.&lt;/P&gt;&lt;P&gt;1) here i have made it into 1 column (for processing later) by choosing delimiter as "+" instead of the real delimiter "|" in the file.&lt;/P&gt;&lt;P&gt;2) i use TRANWRD function to replace 2 of my columns from 99999999 to 0&lt;/P&gt;&lt;P&gt;3) then i use the export function to save into csv.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;some how the result has a ( " ) appearing after 8685th record as shown below?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="parkourtofu_0-1591970975926.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42844i6FD291E6964692C9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="parkourtofu_0-1591970975926.png" alt="parkourtofu_0-1591970975926.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the reasons causing that and how can i fix it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you everyone in advance.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:10:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658071#M197214</guid>
      <dc:creator>parkourtofu</dc:creator>
      <dc:date>2020-06-12T14:10:21Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658078#M197218</link>
      <description>&lt;P&gt;You can do that in one data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
infile "path to infile" lrecl=32767;
file "path to outfile" lrecl=32767;
input;
_infile_ = tranwrd(_infile_,'99999999','00000000');&lt;BR /&gt;put _infile_;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 12 Jun 2020 14:22:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658078#M197218</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-12T14:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658108#M197236</link>
      <description>&lt;P&gt;Without 1) starting data and 2) the actual code used it is hard to tell what you may have done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is about a clear as mud:&lt;/P&gt;
&lt;P&gt;1) i want to zeroise the 2 date columns from 99999999 to 0&lt;/P&gt;
&lt;P&gt;And this is also sort of confusing:&lt;/P&gt;
&lt;P&gt;1) here i have made it into 1 column (for processing later) by choosing delimiter as "+" instead of the real delimiter "|" in the file.&lt;/P&gt;
&lt;P&gt;2) i use TRANWRD function to replace 2 of my columns from 99999999 to 0&lt;/P&gt;
&lt;P&gt;Did you apply Tranwrd to 2 columns or one?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And is the PICTURE (not very good for sharing actual content) from a spreadsheet program? They are know to convert some types of values when opening a CSV file and that can change the actual value. If you did not let a spread sheet save the data file, I suggest opening the file with a Text file editor like Notepad, Wordpad or even the SAS editor, go to the lines where the values change (if they actually do in the text file), copy a couple rows before and after, the paste them into a code box opened on the forum with &amp;lt;/&amp;gt; icon. This last is important because the message windows on the forum will reformat text and may confuse the issue.&lt;/P&gt;
&lt;P&gt;It would also be a good idea to copy the generated code you used to transform the variables and paste that in into a code box as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the column where the " appears involving your "date columns" at all? From the values shown, I do not see anything with a date related value (unless possibly you are using Julian dates).&lt;/P&gt;
&lt;P&gt;Since 99999999 is not any where a typical date value it isn't clear what you start with. Is the value a character or numeric variable?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 15:31:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658108#M197236</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-12T15:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658118#M197243</link>
      <description>&lt;P&gt;Note that if you use the Enterprise Guide import wizard to select a CSV file from your PC and send it to the SAS server for conversion into a SAS dataset it will probably have made some changes to the CSV file in the process.&lt;/P&gt;
&lt;P&gt;You might get more control by using the Copy Files task in EG to just upload the CSV file and write SAS code to read the file.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 16:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658118#M197243</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-06-12T16:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658237#M197275</link>
      <description>&lt;P&gt;Below code changing your .csv directly without reading the data into a SAS table won't perform as good as when using tranwrd(). What it does though is ensure that you only change 99999999 in the selected columns.&lt;/P&gt;
&lt;P&gt;In the regular expression used&amp;nbsp;&lt;CODE class=" language-sas"&gt;^(([^\|]*\|){&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/FONT&gt;})(9{8}\|)&lt;/CODE&gt;&amp;nbsp;the number in red represents the number of columns before the one where you want to change the string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* create sample file */
filename mycsv temp;
data _null_;
  file mycsv;
  put 'abc|def|99999999|1234|99999999|xyx';
  put '99999999|def|78654||99999999|xyx|99999999|abc';
  stop;
run;

/* change 99999999 to 0 if in columns 3 or 5 */
data _null_;
  file print;
  infile mycsv lrecl=32767;
  input;
  put 'Before: ' _infile_;
  _infile_= prxchange('s/^(([^\|]*\|){2})(9{8}\|)/${1}0|/oi', 1, trim(_infile_));
  _infile_= prxchange('s/^(([^\|]*\|){4})(9{8}\|)/${1}0|/oi', 1, trim(_infile_));
  put 'After:  ' _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1592019032428.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42902i7E67B18A7D271D66/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1592019032428.png" alt="Patrick_0-1592019032428.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 13 Jun 2020 03:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658237#M197275</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-13T03:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658365#M197319</link>
      <description>hi i have followed your code but the " still appear in the record.&lt;BR /&gt;i wrote the following:&lt;BR /&gt;data _null_;&lt;BR /&gt;infile "C:\SAS\have.csv" lrecl=32767;&lt;BR /&gt;file "C:\SAS\want.csv" lrecl=32767;&lt;BR /&gt;input;&lt;BR /&gt;_infile_ = tranwrd (_infile_, '99999999','0'); put _infile_; run;</description>
      <pubDate>Sun, 14 Jun 2020 16:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658365#M197319</guid>
      <dc:creator>parkourtofu</dc:creator>
      <dc:date>2020-06-14T16:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658373#M197320</link>
      <description>&lt;P&gt;hi sorry i wasn't being clear enough&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for Starting Data. seen as picture 1 below.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="thumbnail_image007.png" style="width: 399px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42922iEA3F8C1B4F9063C8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="thumbnail_image007.png" alt="thumbnail_image007.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;as for the mentioned step 1. i have use SAS Enterprise Guide "Import Data" function to import the data into SAS server directly without codes. due to the file is too large n have many columns i decided to make all of them into 1 column. the method used will be as follows to make all data into a single column for the intention to "faster processing".&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA WORK.ActILP_EX_2020_05_19_0030;
    LENGTH
        'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n $ 1884 ;
    LABEL
        'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n = "CHDRNUM|CNTTYPE|BILLFREQ|BILLCHNL|SRCEBUS|AGNTNUM|HISSDTE|BNSIND|ZREVBNS|BONUSAMT|ZINTRATE|ZANNTYDT|STATCODE|PSTATCODE|CRTABLE|LIFE|JLIFE|COVERAGE|RIDER|CRRCD|PCESTRM|RCESTRM|BCESTRM|SUMINS|ORIGSUM|ZBINSTPREM|EXTR|ZDISCODE|ZDISPREM|ZGSTPREM|AGE|RETIREAGE|C" ;
    FORMAT
        'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n $CHAR1884. ;
    INFORMAT
        'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n $CHAR1884. ;
    INFILE 'C:\Users\parkourtofu\AppData\Local\Temp\SEG12248\ActILP_EX_2020-05-19-0030-17e38c4b19c0442bbe027eb0ec1ba9d7.txt'
        LRECL=1884
        ENCODING="WLATIN1"
        TERMSTR=CRLF
        DLM='7F'x
        MISSOVER
        DSD ;
    INPUT
        'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n : $CHAR1884. ;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then i use tranwrd to change all the values with 99999999 to zero&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
set WORK.ActILP_EX_2020_05_19_0030;
'CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n=tranwrd('CHDRNUM|CNTTYPE|BILLFREQ|BILLCHN'n , "99999999|", "0|");
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image003.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42924iAD7B64CA013153D6/image-size/small?v=v2&amp;amp;px=200" role="button" title="image003.png" alt="image003.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image002.png" style="width: 200px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/42925iF6FEB256D5E262FD/image-size/small?v=v2&amp;amp;px=200" role="button" title="image002.png" alt="image002.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;these are the date columns of the 332 columns inside my data i wanted to zeorise them.&lt;/P&gt;&lt;P&gt;yes the number that has " isnt the date and when i make them into 1 column, i assume i have made all the data without delimiter into a character form.&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 17:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658373#M197320</guid>
      <dc:creator>parkourtofu</dc:creator>
      <dc:date>2020-06-14T17:19:46Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658374#M197321</link>
      <description>iam unable to find the "Copy Files" in my EG</description>
      <pubDate>Sun, 14 Jun 2020 17:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658374#M197321</guid>
      <dc:creator>parkourtofu</dc:creator>
      <dc:date>2020-06-14T17:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658393#M197328</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333471"&gt;@parkourtofu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;hi i have followed your code but the " still appear in the record.&lt;BR /&gt;i wrote the following:&lt;BR /&gt;data _null_;&lt;BR /&gt;infile "C:\SAS\have.csv" lrecl=32767;&lt;BR /&gt;file "C:\SAS\want.csv" lrecl=32767;&lt;BR /&gt;input;&lt;BR /&gt;_infile_ = tranwrd (_infile_, '99999999','0'); put _infile_; run;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then the quotes are already there in the input.&lt;/P&gt;
&lt;P&gt;Inspect the respective lines in the file with a &lt;U&gt;text editor&lt;/U&gt; (&lt;STRONG&gt;NOT WITH&amp;nbsp;&lt;U&gt;ANY&lt;/U&gt; OTHER SOFTWARE!&lt;/STRONG&gt;).&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 19:15:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658393#M197328</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-14T19:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: weird sign ( " ) appearing after Data Exported into csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658408#M197339</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/333471"&gt;@parkourtofu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;iam unable to find the "Copy Files" in my EG&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Search:&amp;nbsp;&amp;nbsp;&lt;A href="https://www.google.com/search?q=%40sas.com+enterprise+guide+copy+files+task" target="_blank"&gt;https://www.google.com/search?q=%40sas.com+enterprise+guide+copy+files+task&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Read:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sasdummy/2020/05/19/copy-files-in-sas-eg/" target="_blank"&gt;https://blogs.sas.com/content/sasdummy/2020/05/19/copy-files-in-sas-eg/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Jun 2020 20:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/weird-sign-quot-appearing-after-Data-Exported-into-csv/m-p/658408#M197339</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-06-14T20:44:57Z</dc:date>
    </item>
  </channel>
</rss>

