<?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: keep if variable contains.... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182340#M265267</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data newdata;&lt;/P&gt;&lt;P&gt;set original;&lt;/P&gt;&lt;P&gt;if find(&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; ISIN&lt;/SPAN&gt;,'HK','i')&amp;gt;0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Apr 2014 17:57:18 GMT</pubDate>
    <dc:creator>JVarghese</dc:creator>
    <dc:date>2014-04-16T17:57:18Z</dc:date>
    <item>
      <title>keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182339#M265266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi, im a new user and i m not sure how to keep the variables if the contain...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for example i have ISIN: HK0000077468. i want to keep the observations if&amp;nbsp; ISIN contains HK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you kindly provide ur guidance?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 17:02:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182339#M265266</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-16T17:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182340#M265267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data newdata;&lt;/P&gt;&lt;P&gt;set original;&lt;/P&gt;&lt;P&gt;if find(&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; ISIN&lt;/SPAN&gt;,'HK','i')&amp;gt;0;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 17:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182340#M265267</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-04-16T17:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182341#M265268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks for ur kind reply. 2 additional question:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) how would u write the code just to parse the 1st 2 characters? what does 'i' mean?&lt;/P&gt;&lt;P&gt;2) how can write the code if i want to do HK and CN?&lt;/P&gt;&lt;P&gt;ie) &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data newdata;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set original;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if find(&lt;SPAN style="font-weight: inherit; font-style: inherit;"&gt; ISIN&lt;/SPAN&gt;,'HK','i')&amp;gt;0 &amp;amp; find(ISIN, 'CN', 'i')&amp;gt;0;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;is not working....&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 19:34:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182341#M265268</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-16T19:34:01Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182342#M265269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;using substr:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; substr(your_variable,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;) in (&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'HK'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'CN'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 20:18:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182342#M265269</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2014-04-16T20:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182343#M265270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you so much! this is very helpful.&lt;/P&gt;&lt;P&gt;just one more qucik question if u dont mind:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*if i do them seperately, keep the ones with HK/CN;&lt;/P&gt;&lt;P&gt;data sortedbase4; &lt;/P&gt;&lt;P&gt;set sortedbase2;&lt;/P&gt;&lt;P&gt;if countrycode NE 'CN' then delete; &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;data sortedbase4; &lt;/P&gt;&lt;P&gt;set sortedbase2;&lt;/P&gt;&lt;P&gt;if countrycode NE 'HK' then delete; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then try to append them....by &lt;/P&gt;&lt;P&gt;data sortbase3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; update sortedbase3 sortbase4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by countrycode;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;i get an error. could u shed some light? thank you!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 20:25:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182343#M265270</guid>
      <dc:creator>aarony</dc:creator>
      <dc:date>2014-04-16T20:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182344#M265271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have a typo in your dataset names such that you are created SORTEDBASE4 twice and not creating SORTEDBASE3.&lt;/P&gt;&lt;P&gt;You want to use a SET statement instead of an UPDATE.&amp;nbsp; UPDATE is used to apply transactions to a master dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Apr 2014 20:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182344#M265271</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-16T20:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: keep if variable contains....</title>
      <link>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182345#M265272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;if find(&lt;/SPAN&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; ISIN&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;,'HK','i')&amp;gt;0&lt;STRONG&gt; &amp;amp;&lt;/STRONG&gt; find(ISIN, 'CN', 'i')&amp;gt;0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Replace &amp;amp; with OR in your code, you'll get it right!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;STRONG&gt;'i' &lt;/STRONG&gt;is optional and it means to ignore the case of the string. Means whether HK or CN is in lower or upper case, that'll work irrespective of the case.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Apr 2014 00:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/keep-if-variable-contains/m-p/182345#M265272</guid>
      <dc:creator>JVarghese</dc:creator>
      <dc:date>2014-04-17T00:40:22Z</dc:date>
    </item>
  </channel>
</rss>

