<?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 find a string within another string and then grab the value of from another variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799231#M314240</link>
    <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;It means variable A from first dataset looks at the field A second dataset and brings a value from anther field.&lt;/P&gt;
&lt;P&gt;For Example:&lt;/P&gt;
&lt;P&gt;If cervical cancer from table A is found in string of column A of second dataset (cervical cancer screening), then bring the code which exists in a different column in second dataset in the result of the query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cervical cancer is a substring of cervical cancer screening, then bring code that is in the observation of cervical cancer screening, but in a different column.&lt;/P&gt;
&lt;P&gt;Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 01 Mar 2022 01:53:15 GMT</pubDate>
    <dc:creator>GN0001</dc:creator>
    <dc:date>2022-03-01T01:53:15Z</dc:date>
    <item>
      <title>How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799061#M314163</link>
      <description>&lt;PRE&gt;data find;
input diseaseName $160. code $45.;
datalines;
cervical cancer 123.z
HepA 9970&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/PRE&gt;
&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;I want to find a string within another string, if it is found, then grab the correspondent values from another variable.&lt;/P&gt;
&lt;P&gt;For example, if value of cervical if found in cervical cancer, then grap the character 123.z.&lt;/P&gt;
&lt;P&gt;Any help is greatly appreciated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue &amp;amp; blue&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 03:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799061#M314163</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-28T03:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799063#M314165</link>
      <description>&lt;P&gt;First of all, the data step you presented does not work correctly, please correct it to the correct one.&lt;/P&gt;
&lt;P&gt;If you want to find a string, you can use the find function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if(find(diseaseName,'cervical','I'))then newcode=code;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Feb 2022 04:09:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799063#M314165</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-02-28T04:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799071#M314170</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;This doesn't bring the value from other variable when we find one string within another string.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue&amp;amp;blue&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 04:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799071#M314170</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-02-28T04:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799073#M314172</link>
      <description>First of all, can you tell me exactly what kind of data you want to derive from what kind of data?&lt;BR /&gt;Not inaccurate data steps.</description>
      <pubDate>Mon, 28 Feb 2022 04:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799073#M314172</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2022-02-28T04:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799091#M314185</link>
      <description>&lt;P&gt;Please explain what "grab the correspondent values from another variable" actually means by showing the expected output.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Feb 2022 07:51:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799091#M314185</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-02-28T07:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799156#M314213</link>
      <description>&lt;P&gt;When posting code to illustrate data you should run the code before posting it.&lt;/P&gt;
&lt;P&gt;When I run your data step this is my log:&lt;/P&gt;
&lt;PRE&gt;1    data find;
2    input diseaseName $160. code $45.;
3    datalines;

NOTE: LOST CARD.
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+--
6          ;
diseaseName=HepA 9970 code=  _ERROR_=1 _N_=1
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
&lt;/PRE&gt;
&lt;P&gt;What has happened is that you are unconditionally attempting to read 160 characters into the first variable which is longer than the data line you provide. If you must include example data with spaces in the values it is a good idea to use delimited text to simplify coding and correctly read the spaces.&lt;/P&gt;
&lt;PRE&gt;data find;
infile datalines dlm=',' ;
input diseaseName :$160. code :$45.;
datalines;
cervical cancer,123.z
HepA, 9970
;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Feb 2022 16:04:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799156#M314213</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-28T16:04:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799230#M314239</link>
      <description>&lt;P&gt;Hello Tom,&lt;/P&gt;
&lt;P&gt;I couldn't understand anything of this:&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;What has happened is that you are unconditionally attempting to read 160 characters into the first variable which is longer than the data line you provide. If you must include example data with spaces in the values it is a good idea to use delimited text to simplify coding and correctly read the spaces."&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Obviously, I want my first variable to have more space if I need it so, I can provide max lenght.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;f you must include example data with spaces in the values it is a good idea to use delimited text to simplify coding and correctly read the spaces."&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Are you saying to put my text in single quotes if the content of a variable has space?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BlueBlue&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 01:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799230#M314239</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-01T01:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within another string and then grab the value of from another variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799231#M314240</link>
      <description>&lt;P&gt;Hello team,&lt;/P&gt;
&lt;P&gt;It means variable A from first dataset looks at the field A second dataset and brings a value from anther field.&lt;/P&gt;
&lt;P&gt;For Example:&lt;/P&gt;
&lt;P&gt;If cervical cancer from table A is found in string of column A of second dataset (cervical cancer screening), then bring the code which exists in a different column in second dataset in the result of the query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cervical cancer is a substring of cervical cancer screening, then bring code that is in the observation of cervical cancer screening, but in a different column.&lt;/P&gt;
&lt;P&gt;Hope this makes sense.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;blue blue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 01:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-another-string-and-then-grab-the/m-p/799231#M314240</guid>
      <dc:creator>GN0001</dc:creator>
      <dc:date>2022-03-01T01:53:15Z</dc:date>
    </item>
  </channel>
</rss>

