<?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: how to remove special characters? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205605#M38232</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to remove square brackets in my variable before exporting to .csv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran this code and could not see the leading zeros in .csv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length number $10;&lt;/P&gt;&lt;P&gt;input number;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;[1234567]&lt;/P&gt;&lt;P&gt;[0234567]&lt;/P&gt;&lt;P&gt;[00004]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;number = compress(number,'[]');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc export data=want outfile='/usr/sas/tir/work/process_id.csv' dbms=csv replace;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 24 Aug 2015 10:43:38 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2015-08-24T10:43:38Z</dc:date>
    <item>
      <title>how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205597#M38224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've&amp;nbsp; a data like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number&lt;/P&gt;&lt;P&gt;[1234567]&lt;/P&gt;&lt;P&gt;[0234567]&lt;/P&gt;&lt;P&gt;[00004]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've written the code like below to remove square brackets. However, I could not see the leading zeros after exporting the dataset to .csv.&amp;nbsp; I need leading zeros in my .csv after removing square brackets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Number_want=left(compress(Number,,'kad'));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 08:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205597#M38224</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-08-24T08:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205598#M38225</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use compress:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;Number="[1234567]"; output;&lt;/P&gt;&lt;P&gt;number="[0234567]"; output;&lt;/P&gt;&lt;P&gt;number="[00004]"; output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; number=compress(number,"[]");&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note, its not a good idea to call what is obviously a character variable number.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 09:16:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205598#M38225</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-24T09:16:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205599#M38226</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You meant to say that we will get a leading zeros in .csv only if we put double quotes in the variable 'Number'?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 09:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205599#M38226</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-08-24T09:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205600#M38227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I ran your code and did proc export to .csv, but still I could not see leading zeros in CSV file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:01:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205600#M38227</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-08-24T10:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205601#M38228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the length(here it refers to number of characters) of the variable is fixed, then you can use Z. format or picture format.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:08:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205601#M38228</guid>
      <dc:creator>MadhuKorni</dc:creator>
      <dc:date>2015-08-24T10:08:52Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205602#M38229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not fixed like my sample data.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:13:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205602#M38229</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-08-24T10:13:15Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205603#M38230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I have just re-read your post.&amp;nbsp; It has nothing to do with SAS this.&amp;nbsp; What I believe you are doing is opening the CSV (thats a text comma separated variable file) in Excel.&amp;nbsp; One of Excel's "Features" is that it will remove preceding zeroes from numbers.&amp;nbsp; You rproblem is with Excel, and the simplest solution is to not use it for *anything*.&amp;nbsp; I can't stress that enough.&amp;nbsp; Now if you open the CSV in Notepad, what do you see, is the data correct?&amp;nbsp; If it is missing the zeroes, then you will need to examine the code or the options you used to export the data.&amp;nbsp; If you had taken the proper approach and write a datastep to put out the data, you can put it as you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205603#M38230</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-08-24T10:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205604#M38231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;See this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length number $10;&lt;/P&gt;&lt;P&gt;input number;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;[1234567]&lt;/P&gt;&lt;P&gt;[0234567]&lt;/P&gt;&lt;P&gt;[00004]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;number = compress(number,'[]');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;set want;&lt;/P&gt;&lt;P&gt;file '$HOME/want1.csv';&lt;/P&gt;&lt;P&gt;if _n_ = 1 then put 'number';&lt;/P&gt;&lt;P&gt;put number;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc export data=want file='$HOME/want2.csv' dbms=csv replace;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This are the resulting csv files:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$ cat want*&lt;/P&gt;&lt;P&gt;number&lt;/P&gt;&lt;P&gt;1234567&lt;/P&gt;&lt;P&gt;0234567&lt;/P&gt;&lt;P&gt;00004&lt;/P&gt;&lt;P&gt;number&lt;/P&gt;&lt;P&gt;1234567&lt;/P&gt;&lt;P&gt;0234567&lt;/P&gt;&lt;P&gt;00004&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where is the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Correction because of erroneous use of dataset have in export steps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205604#M38231</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-08-24T10:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205605#M38232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I need to remove square brackets in my variable before exporting to .csv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I ran this code and could not see the leading zeros in .csv.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length number $10;&lt;/P&gt;&lt;P&gt;input number;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;[1234567]&lt;/P&gt;&lt;P&gt;[0234567]&lt;/P&gt;&lt;P&gt;[00004]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;number = compress(number,'[]');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc export data=want outfile='/usr/sas/tir/work/process_id.csv' dbms=csv replace;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205605#M38232</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2015-08-24T10:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205606#M38233</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;length number $10;&lt;/P&gt;&lt;P&gt;input number;&lt;/P&gt;&lt;P&gt;number=compress(number,'[]');&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;[1234567]&lt;/P&gt;&lt;P&gt;[0234567]&lt;/P&gt;&lt;P&gt;[00004]&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc export data = have outfile = "path\filename.csv" dbms = csv replace;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output in CSV :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;number&lt;/P&gt;&lt;P&gt;1234567&lt;/P&gt;&lt;P&gt;0234567&lt;/P&gt;&lt;P&gt;00004&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:45:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205606#M38233</guid>
      <dc:creator>MadhuKorni</dc:creator>
      <dc:date>2015-08-24T10:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: how to remove special characters?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205607#M38234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;PLEASE, would you care to READ?&lt;/P&gt;&lt;P&gt;I supplied the listing of the .csv's I created, and BOTH contain the LEADING ZEROES!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do&lt;/P&gt;&lt;P&gt;cat /usr/sas/tir/work/process_id.csv&lt;/P&gt;&lt;P&gt;on the SAS server, or copy the file to your local machine and open it with notepad.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DON'T use Excel, because it recognizes the values as numbers and converts them, and does not display leading zeroes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 24 Aug 2015 10:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-remove-special-characters/m-p/205607#M38234</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2015-08-24T10:54:52Z</dc:date>
    </item>
  </channel>
</rss>

