<?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: ' in value in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549672#M8713</link>
    <description>&lt;P&gt;And an old school alternative:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
length x1 $50;
x1 = 'How about "this"?';
output;
x1 = 'That''s it!';
output;
run;&lt;/PRE&gt;
&lt;P&gt;That is two single quotes in the middle that will resolve to a single in the value.&lt;/P&gt;
&lt;P&gt;Which can be useful if you have macro related special characters &amp;amp; and % elsewhere in the value such as&lt;/P&gt;
&lt;PRE&gt;data test;
length x1 $50;
x1 = 'John''s Feed &amp;amp;Grain';
output;
x1 = "John's Feed &amp;amp;Grain";
output;
run;&lt;/PRE&gt;
&lt;P&gt;where the second assignment generates a warning in the log. If you happen to actually have a macro variable named GRAIN at the time you may get unexpected results.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Apr 2019 16:18:47 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-04-09T16:18:47Z</dc:date>
    <item>
      <title>' in value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549534#M8688</link>
      <description>&lt;P&gt;Hi, I wanted to create a new variable from my data set. I tried to use If - then - Else if statement to do this. However, there is one value in the original variable contains symbol '. Thus I cannot write the Else if statement for this value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 499px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28543iC4273B9E96573A82/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is value ' Master's Degree' which will create an error because of the symbol '.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 449px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/28545i88225B17A27423DC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried to run IF-Else if-else statement but didn't work as well. Please help &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt; thanks a lot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data hth1n18.data;&lt;BR /&gt;set hth1n18.data;&lt;BR /&gt;If Qu_10 = 'High School' then Qu_10_num = 1;&lt;BR /&gt;Else If Qu_10 = 'High School/Secondary School' then Qu_10_num=1;&lt;BR /&gt;Else If Qu_10 = 'High School/Secondary School&amp;amp;amp' then Qu_10_num =1;&lt;BR /&gt;Else If Qu_10 = 'Some College' then Qu_10_num=2;&lt;BR /&gt;Else If Qu_10 = 'Some College &amp;nbsp;' then Qu_10_num=2;&lt;BR /&gt;Else If Qu_10 = 'Some College&amp;amp;amp;amp;nbsp;&amp;amp;amp;a' then Qu_10_num=2;&lt;BR /&gt;Else If Qu_10 = 'Some College&amp;amp;amp;nbsp;&amp;amp;amp;nbsp;' then Qu_10_num=2;&lt;BR /&gt;Else If Qu_10 = 'College' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'College Degree' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'College/University Degree' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'College/University Degree&amp;amp;amp;am' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'College/University Degree&amp;amp;amp;nb' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'College/University Degree&amp;nbsp;' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'University' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'University Degree' then Qu_10_num=3;&lt;BR /&gt;Else If Qu_10 = 'Master' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master&amp;amp;#039;s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master&amp;amp;amp;amp;rsquo;s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master&amp;amp;amp;rsquo;s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master&amp;amp;rsquo;s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Masters Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master’s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Master¡¯s Degree' then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 'Doctoral Degree' then Qu_10_num=5;&lt;BR /&gt;Else If Qu_10 = 'Doctoral Degree&amp;amp;amp;amp;nbsp;&amp;amp;am' then Qu_10_num=5;&lt;BR /&gt;Else If Qu_10 = 'Doctoral Degree&amp;amp;amp;nbsp;&amp;amp;amp;nb' then Qu_10_num=5;&lt;BR /&gt;Else If Qu_10 = 1 then Qu_10_num = 1;&lt;BR /&gt;Else If Qu_10 = 2 then Qu_10_num = 2;&lt;BR /&gt;Else If Qu_10 = 3 then Qu_10_num = 3;&lt;BR /&gt;Else If Qu_10 = 4 then Qu_10_num=4;&lt;BR /&gt;Else If Qu_10 = 5 then Qu_10_num=5;&lt;BR /&gt;Else If Qu_10 = . then Qu_10_num=.;&lt;BR /&gt;Else Qu_10_num=4;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 09:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549534#M8688</guid>
      <dc:creator>Cassie2</dc:creator>
      <dc:date>2019-04-09T09:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: ' in value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549539#M8689</link>
      <description>&lt;P&gt;When you have to put a single quote into a string, use double quotes around the string, and vice versa:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length x1 $50;
x1 = 'How about "this"?';
output;
x1 = "That's it!";
output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 10:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549539#M8689</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-09T10:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: ' in value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549540#M8690</link>
      <description>&lt;P&gt;Do this instead (Double quotes)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Else If Qu_10 = "Master’s Degree" then Qu_10_num=4;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Apr 2019 10:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549540#M8690</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-04-09T10:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: ' in value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549541#M8691</link>
      <description>&lt;P&gt;Oh just simple as that, haha! Thanks a lot, it worked.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 10:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549541#M8691</guid>
      <dc:creator>Cassie2</dc:creator>
      <dc:date>2019-04-09T10:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: ' in value</title>
      <link>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549672#M8713</link>
      <description>&lt;P&gt;And an old school alternative:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test;
length x1 $50;
x1 = 'How about "this"?';
output;
x1 = 'That''s it!';
output;
run;&lt;/PRE&gt;
&lt;P&gt;That is two single quotes in the middle that will resolve to a single in the value.&lt;/P&gt;
&lt;P&gt;Which can be useful if you have macro related special characters &amp;amp; and % elsewhere in the value such as&lt;/P&gt;
&lt;PRE&gt;data test;
length x1 $50;
x1 = 'John''s Feed &amp;amp;Grain';
output;
x1 = "John's Feed &amp;amp;Grain";
output;
run;&lt;/PRE&gt;
&lt;P&gt;where the second assignment generates a warning in the log. If you happen to actually have a macro variable named GRAIN at the time you may get unexpected results.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2019 16:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/in-value/m-p/549672#M8713</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-09T16:18:47Z</dc:date>
    </item>
  </channel>
</rss>

