<?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 Remove hidden characters from a variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529234#M144543</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a text from a variable that has some repeated quotes and I want to remove those.&amp;nbsp;I tried dequote, compress functions&amp;nbsp;it didn't work. Any help is much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I copy the text to notepad it's like this:&lt;/P&gt;
&lt;P&gt;"""test:{""""text"""":""""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"""&lt;/P&gt;
&lt;P&gt;But when I see it in the dataset it's like this:&lt;/P&gt;
&lt;P&gt;"test:{""text"":""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Jan 2019 19:43:29 GMT</pubDate>
    <dc:creator>AshleyBright</dc:creator>
    <dc:date>2019-01-22T19:43:29Z</dc:date>
    <item>
      <title>Remove hidden characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529234#M144543</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a text from a variable that has some repeated quotes and I want to remove those.&amp;nbsp;I tried dequote, compress functions&amp;nbsp;it didn't work. Any help is much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I copy the text to notepad it's like this:&lt;/P&gt;
&lt;P&gt;"""test:{""""text"""":""""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"""&lt;/P&gt;
&lt;P&gt;But when I see it in the dataset it's like this:&lt;/P&gt;
&lt;P&gt;"test:{""text"":""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 19:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529234#M144543</guid>
      <dc:creator>AshleyBright</dc:creator>
      <dc:date>2019-01-22T19:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Remove hidden characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529245#M144546</link>
      <description>&lt;P&gt;Try to see if the quotes are actually the same character:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_; set have (obs=1); put var $hex6. run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you get 222222, I have no&amp;nbsp;suggestions based on the information so far. otherwise the unwantet can be renoved with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;var = compress(var,'nn'x),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where nn is the&amp;nbsp;2&amp;nbsp;chars that is not 22.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 20:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529245#M144546</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-01-22T20:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove hidden characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529252#M144551</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; COMPRESS worked for me when I did this:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="4" face="courier new,courier"&gt;newvar1=compress(var1,&lt;FONT color="#FF0000"&gt;'&lt;/FONT&gt;"&lt;FONT color="#FF0000"&gt;'&lt;/FONT&gt;); &lt;/FONT&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that is &lt;FONT color="#FF0000"&gt;single quote&lt;/FONT&gt;-double quote-&lt;FONT color="#FF0000"&gt;single quote&lt;/FONT&gt; inside the Compress function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Here's the code I ran -- first I made the variables, with both types of multiple quotes and then I used COMPRESS.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data with_qt;
length var1 var2 $125;
var1='"test:{""text"":""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"';
var2='"""test:{""""text"""":""""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"""';
run;

data without_qt;
  set with_qt;
  newvar1 = compress(var1,'"');
  newvar2 = compress(var2,'"');
run;

** proc print steps;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="use_compress.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26497iCD8F158B94AB772F/image-size/large?v=v2&amp;amp;px=999" role="button" title="use_compress.png" alt="use_compress.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;(I did a separate PROC PRINT for every variable so they'd line up one under the other for comparison.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 20:16:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529252#M144551</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2019-01-22T20:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Remove hidden characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529263#M144561</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42569"&gt;@AshleyBright&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a text from a variable that has some repeated quotes and I want to remove those.&amp;nbsp;I tried dequote, compress functions&amp;nbsp;it didn't work. Any help is much appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I copy the text to notepad it's like this:&lt;/P&gt;
&lt;P&gt;"""test:{""""text"""":""""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"""&lt;/P&gt;
&lt;P&gt;But when I see it in the dataset it's like this:&lt;/P&gt;
&lt;P&gt;"test:{""text"":""test/5.0 (werrwe VV 1.0; Qwe77; y99) TestTestTest/123.89 (ABCD"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Again I ask, with some more details, what do you copy from? The Viewtable when opening a dataset&amp;nbsp;in the SAS explorer? or something else?&lt;/P&gt;
&lt;P&gt;When I create a string like what you see in the "dataset" and copy from Viewtable&amp;nbsp;to Notepad I do not get any additional quotes in the&amp;nbsp; string. And please show using the create data step from the data macro, some of&amp;nbsp;the values involved. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;Or paste some lines from the raw data file and the SAS program to read it into a code box opened using the forum's {I} icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 21:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529263#M144561</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-01-22T21:05:22Z</dc:date>
    </item>
    <item>
      <title>Re: Remove hidden characters from a variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529278#M144573</link>
      <description>&lt;P&gt;If you suspect there is some funky character there, remember you can use an expression as the second parameter to COMPRESS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;textvar = compress(textvar, substr(textvar, 1, 1));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You don't necessarily need to find out what the character is, in order to remove it.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Jan 2019 21:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-hidden-characters-from-a-variable/m-p/529278#M144573</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-01-22T21:54:57Z</dc:date>
    </item>
  </channel>
</rss>

