<?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 help with question on page87-88, practice, SQL1 essential in Advanced Programming</title>
    <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959342#M275</link>
    <description>&lt;P&gt;Hi, anyone did this question and can help? I have two questions about the solution and code for the challenge practice on page87-88 of SQL1 essential pdf. (1) why do I get those brackets () for the &lt;EM&gt;pctincrease&lt;/EM&gt; column in the output (see below)? I did not write any brackets() in my code. (2) in &lt;EM&gt;where&lt;/EM&gt; statement, for some reason I cannot write the complete value("&lt;EM&gt;Borrowed for health or medical purposes (% age 15+)&lt;/EM&gt;") of the indicatorname column (I do not think I had spelling or upcase or lowcase problems), if I write the complete value I got nothing&amp;nbsp; in the output table&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select region,
       (mean(estyear1pct)/100)*sum(estyear1pop) as estcount1
                        format=comma12.,
       (mean(estyear3pct)/100)*sum(estyear3pop) as estcount3
                        format=comma12.,
       (calculated estcount3-calculated estcount1)/calculated estcount1
                        as pctincrease format=percent7.2
   from sq.globalfull
   where indicatorname like "%health%"
   group by region
   order by pctincrease desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104674i590F10D22832F2BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled1.png" alt="Untitled1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 17 Feb 2025 10:34:08 GMT</pubDate>
    <dc:creator>dxiao2017</dc:creator>
    <dc:date>2025-02-17T10:34:08Z</dc:date>
    <item>
      <title>help with question on page87-88, practice, SQL1 essential</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959342#M275</link>
      <description>&lt;P&gt;Hi, anyone did this question and can help? I have two questions about the solution and code for the challenge practice on page87-88 of SQL1 essential pdf. (1) why do I get those brackets () for the &lt;EM&gt;pctincrease&lt;/EM&gt; column in the output (see below)? I did not write any brackets() in my code. (2) in &lt;EM&gt;where&lt;/EM&gt; statement, for some reason I cannot write the complete value("&lt;EM&gt;Borrowed for health or medical purposes (% age 15+)&lt;/EM&gt;") of the indicatorname column (I do not think I had spelling or upcase or lowcase problems), if I write the complete value I got nothing&amp;nbsp; in the output table&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select region,
       (mean(estyear1pct)/100)*sum(estyear1pop) as estcount1
                        format=comma12.,
       (mean(estyear3pct)/100)*sum(estyear3pop) as estcount3
                        format=comma12.,
       (calculated estcount3-calculated estcount1)/calculated estcount1
                        as pctincrease format=percent7.2
   from sq.globalfull
   where indicatorname like "%health%"
   group by region
   order by pctincrease desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104674i590F10D22832F2BC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled1.png" alt="Untitled1.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 10:34:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959342#M275</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-02-17T10:34:08Z</dc:date>
    </item>
    <item>
      <title>Re: help with question on page87-88, practice, SQL1 essential</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959352#M276</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;why do I get those brackets () for the&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;pctincrease&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;column in the output (see below)? I did not write any brackets() in my code.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You are using SAS format &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/ds2ref/n1sw88r281qsn1n1r77pj0zn40ha.htm" target="_self"&gt;PERCENTw.d&lt;/A&gt; to print the numbers. This format prints negative numbers in brackets&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1739789121073.png" style="width: 1188px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104675i2CAA0F58BF63E39A/image-dimensions/1188x18?v=v2" width="1188" height="18" role="button" title="Patrick_0-1739789121073.png" alt="Patrick_0-1739789121073.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;for some reason I cannot write the complete value("&lt;/SPAN&gt;&lt;EM&gt;Borrowed for health or medical purposes (% age 15+)&lt;/EM&gt;&lt;SPAN&gt;") of the indicatorname column&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The percent sign % is also a SAS macro token. If you use it as a wildcard in a SQL like expression always use single quotes so SAS doesn't treat it as macro token (if you haven't gotten to SAS Macro language yet just take this use single quotes as a rule. You'll understand later the why).&lt;BR /&gt;The % in a SQL like expression is a wildcard for one or multiple characters. If you want to search for the actual character % then you should escape it as done in below sample code.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The search as such for the full string works for me which makes me think that the search string you're using doesn't match the data (which includes whitespace characters like if you believe it's blank but what's stored is actually a tab).&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.have;
  length indicatorname $60;
  indicatorname='Borrowed for health or medical purposes (% age 15+)'; output;
run;

proc sql;
  select *
  from work.have
  where indicatorname like 'Borrowed for health or medical purposes (^% age 15+)' escape '^'
  ;
  select *
  from work.have
  where indicatorname = 'Borrowed for health or medical purposes (% age 15+)'
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_1-1739790110440.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104677iE0949580EEC6233A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_1-1739790110440.png" alt="Patrick_1-1739790110440.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2025 11:04:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959352#M276</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2025-02-17T11:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: help with question on page87-88, practice, SQL1 essential</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959501#M277</link>
      <description>&lt;P&gt;Hi Patrick, thanks very much for your quick reply, accurately solves my problem.&amp;nbsp;&lt;SPAN&gt;I did not notice that in the rows that have brackets, the value of estcount3-estcount1 was negative numbers and then I was thinking I would not get any answer by searching the internet or any help documents all the way on the internet (you even don't know what key word or question you can search for, isn't it).&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the second problem, I tried both single and double quotation mark and still got nothing, and I think you are right about that the string doesn't match the data (for some reason, which need further explore and identifying), my code and the value in the input dateset are as follows.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled1.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104704iFC182EA5E5DEDBD6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled1.png" alt="Untitled1.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled2.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104705i030B9072167DD609/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled2.png" alt="Untitled2.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The column and value in the input dataset is as follows.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled3.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104706iD12734EB12D882EA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Untitled3.png" alt="Untitled3.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Both single and double quotation mark work when I use that &lt;EM&gt;where indicatorname like %health%;&lt;/EM&gt; statement and what I get in the result is the same as the answer provided by the question. &lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 16:34:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959501#M277</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-02-18T16:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: help with question on page87-88, practice, SQL1 essential</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959506#M278</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/466238"&gt;@dxiao2017&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Isn't there a blank between "purposes" and "(% age 15+)", which is missing in your code?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="with_blank.png" style="width: 372px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104707i05B869E310902113/image-size/large?v=v2&amp;amp;px=999" role="button" title="with_blank.png" alt="with_blank.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="without_blank.png" style="width: 467px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104709iF84E4D42D7849320/image-size/large?v=v2&amp;amp;px=999" role="button" title="without_blank.png" alt="without_blank.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 16:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959506#M278</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-02-18T16:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: help with question on page87-88, practice, SQL1 essential</title>
      <link>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959515#M279</link>
      <description>&lt;P&gt;Hi Reinh, you are right, solved my problem! I thought I paid sufficient attention to all details but while doing this question I actually was not. The code and result is as below.&amp;nbsp;Double quotation mark also works and produced the same result.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select region,
       (mean(estyear1pct)/100)*sum(estyear1pop) as estcount1
                        format=comma12.,
       (mean(estyear3pct)/100)*sum(estyear3pop) as estcount3
                        format=comma12.,
       (calculated estcount3-calculated estcount1)/calculated estcount1
                        as pctincrease format=percent7.2
   from sq.globalfull
   where indicatorname='Borrowed for health or medical purposes (% age 15+)'
   group by region
   order by pctincrease desc;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Untitled3a.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/104710i583B39A488F6519E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Untitled3a.png" alt="Untitled3a.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Feb 2025 17:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Advanced-Programming/help-with-question-on-page87-88-practice-SQL1-essential/m-p/959515#M279</guid>
      <dc:creator>dxiao2017</dc:creator>
      <dc:date>2025-02-18T17:49:31Z</dc:date>
    </item>
  </channel>
</rss>

