<?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: Substring to extract house number and post code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585582#M167022</link>
    <description>Thanks a lot!</description>
    <pubDate>Mon, 02 Sep 2019 11:13:25 GMT</pubDate>
    <dc:creator>jeremy4</dc:creator>
    <dc:date>2019-09-02T11:13:25Z</dc:date>
    <item>
      <title>Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585558#M167001</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following example, which is only a &lt;U&gt;&lt;FONT color="#ff0000"&gt;partial extract&lt;/FONT&gt; &lt;/U&gt;of all of the observations for the&lt;U&gt;&lt;FONT color="#ff0000"&gt; variable&lt;/FONT&gt;&lt;/U&gt; "&lt;U&gt;&lt;FONT color="#ff0000"&gt;address&lt;/FONT&gt;&lt;/U&gt;":&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Dataset:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Two variables are in the project.address dataset - account_number and Address. Note: the example below just contains a partial extract of observations in the Address variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Address&lt;/P&gt;&lt;P&gt;FULLNAMEMackenzie M. ThompsonADDRESS&lt;FONT color="#ff0000"&gt;60&lt;/FONT&gt; Boroughbridge RoadTOWNBIRKHALLPOSTCODE&lt;FONT color="#ff0000"&gt;AB35&lt;/FONT&gt; &lt;FONT color="#ff0000"&gt;3LW&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;FULLNAMEEvelyn F. HillADDRESS&lt;FONT color="#ff0000"&gt;18&lt;/FONT&gt; St James BoulevardTOWNHORSEBROOKPOSTCODE&lt;FONT color="#ff0000"&gt;ST19 5EQ&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;FULLNAMEElise R. HayADDRESS&lt;FONT color="#ff0000"&gt;15&lt;/FONT&gt; Sloe LaneTOWNCROSTHWAITEPOSTCODE&lt;FONT color="#ff0000"&gt;LA8&lt;/FONT&gt; &lt;FONT color="#ff0000"&gt;6TP&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;FULLNAMEAntonia M. HendersonADDRESS&lt;FONT color="#ff0000"&gt;3&lt;/FONT&gt; Exning RoadTOWNHARLEYHOLMPOSTCODE&lt;FONT color="#ff0000"&gt;ML12&lt;/FONT&gt; &lt;FONT color="#ff0000"&gt;2JZ&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please help me extract the house number and post code, using substring/find/scan/index for the "&lt;U&gt;&lt;FONT color="#ff0000"&gt;address&lt;/FONT&gt;&lt;/U&gt;" &lt;U&gt;&lt;FONT color="#ff0000"&gt;variable&lt;/FONT&gt;&lt;/U&gt;, ie. &lt;FONT color="#ff0000"&gt;house_number = substr(address, , )&lt;/FONT&gt;&amp;nbsp;where:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;House number&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Are the numbers from the&lt;FONT color="#ff9900"&gt; third word&lt;/FONT&gt;, split by the &lt;FONT color="#ff9900"&gt;space delimiter&lt;/FONT&gt; (this can be either 1 or 2 numbers).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT color="#ff0000"&gt;Would the best approach be to find the number(s) coming after 'ADDRESS' in the third word based on the space delimiter?&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Post code&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Last three or four characters and numbers from the &lt;FONT color="#ff9900"&gt;end of the second last word&lt;/FONT&gt;, plus (using the catx function?)&amp;nbsp;the last three characters and numbers from the &lt;FONT color="#ff9900"&gt;last word&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;FONT color="#ff0000"&gt;Would the best approach be to find what comes after 'POSTCODE' and use substr to find a length of 8 (as this would include 1 or 2 numbers for the start of the post code)?&lt;/FONT&gt;&lt;/U&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585558#M167001</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T10:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585561#M167004</link>
      <description>&lt;P&gt;please try the perl regular expressions as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input text&amp;amp;:$500.;
housenumber=prxchange('s/(.*address)(\d{1,2})(.*)/$2/i',-1,strip(text));
postcode=prxchange('s/(.*postcode)(.*)/$2/i',-1,strip(text));
cards;
FULLNAMEMackenzie M. ThompsonADDRESS60 Boroughbridge RoadTOWNBIRKHALLPOSTCODEAB35 3LW
FULLNAMEEvelyn F. HillADDRESS18 St James BoulevardTOWNHORSEBROOKPOSTCODEST19 5EQ
FULLNAMEElise R. HayADDRESS15 Sloe LaneTOWNCROSTHWAITEPOSTCODELA8 6TP
FULLNAMEAntonia M. HendersonADDRESS3 Exning RoadTOWNHARLEYHOLMPOSTCODEML12 2JZ
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 09:33:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585561#M167004</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-02T09:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585562#M167005</link>
      <description>&lt;P&gt;Assuming your data is representable and you insist on not using Regular Expressions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input string $200.;
datalines;
FULLNAMEMackenzie M. ThompsonADDRESS60 Boroughbridge RoadTOWNBIRKHALLPOSTCODEAB35 3LW
FULLNAMEEvelyn F. HillADDRESS18 St James BoulevardTOWNHORSEBROOKPOSTCODEST19 5EQ
FULLNAMEElise R. HayADDRESS15 Sloe LaneTOWNCROSTHWAITEPOSTCODELA8 6TP
FULLNAMEAntonia M. HendersonADDRESS3 Exning RoadTOWNHARLEYHOLMPOSTCODEML12 2JZ
;

data want(drop=p);
    set have;
    housenum=input(compress(scan(string, 3), '', 'kd'), 8.);
    p=index(string,"POSTCODE");
    postcode=substr(string, p+9, length(string)-p);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 09:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585562#M167005</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T09:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585563#M167006</link>
      <description>&lt;P&gt;Alternatively without the perl regular expressions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input text&amp;amp;:$500.;
text2=tranwrd(tranwrd(lowcase(text),'address','|'),'postcode','#');
housenumber=scan(scan(lowcase(strip(text2)),2,'|'),1,' ');
postcode=upcase(scan(lowcase(strip(text2)),2,'#'));
cards;
FULLNAMEMackenzie M. ThompsonADDRESS60 Boroughbridge RoadTOWNBIRKHALLPOSTCODEAB35 3LW
FULLNAMEEvelyn F. HillADDRESS18 St James BoulevardTOWNHORSEBROOKPOSTCODEST19 5EQ
FULLNAMEElise R. HayADDRESS15 Sloe LaneTOWNCROSTHWAITEPOSTCODELA8 6TP
FULLNAMEAntonia M. HendersonADDRESS3 Exning RoadTOWNHARLEYHOLMPOSTCODEML12 2JZ
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 09:42:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585563#M167006</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-02T09:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585564#M167007</link>
      <description>Thanks for your reply, how would the code change if datalines were not used (there are thousands of observations in my dataset), as my example was just a partial extract of observations from the "address" variable, so could it be changed to something along the lines of house_number = substr(address, , )? Thanks!</description>
      <pubDate>Mon, 02 Sep 2019 09:46:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585564#M167007</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T09:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585565#M167008</link>
      <description>&lt;P&gt;Considering that the data is in a dataset then you can try set statement as below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set mydata;
text2=tranwrd(tranwrd(lowcase(text),'address','|'),'postcode','#');
housenumber=scan(scan(lowcase(strip(text2)),2,'|'),1,' ');
postcode=upcase(scan(lowcase(strip(text2)),2,'#'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 09:49:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585565#M167008</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-02T09:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585566#M167009</link>
      <description>&lt;P&gt;Thanks for your reply, I've just run your code and it creates two new variables, address and postcode. However, there are just blank observations for the corresponding original examples - is there anything I could change in the code (my dataset just contains an "Account_number" and "address" variable (partial extract was shown in my original post))?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 09:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585566#M167009</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T09:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585568#M167011</link>
      <description>&lt;P&gt;Could you please post the code you attempted, you need to replace the text with the variable which has address info per your data.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:13:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585568#M167011</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-02T10:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585569#M167012</link>
      <description>&lt;P&gt;The variable containing all of the information is&amp;nbsp;called &lt;FONT color="#ff0000"&gt;variable&lt;/FONT&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data project;&lt;BR /&gt;set project.address;&lt;BR /&gt;text2=tranwrd(tranwrd(lowcase(text),'ADDRESS','|'),'POSTCODE','#');&lt;BR /&gt;housenumber=scan(scan(lowcase(strip(text2)),2,'|'),1,' ');&lt;BR /&gt;postcode=upcase(scan(lowcase(strip(text2)),2,'#'));&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:21:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585569#M167012</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T10:21:31Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585570#M167013</link>
      <description>&lt;P&gt;So what variable contains the string you post above?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:21:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585570#M167013</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T10:21:23Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585571#M167014</link>
      <description>It's called Address - I've updated my original post to include extra information.</description>
      <pubDate>Mon, 02 Sep 2019 10:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585571#M167014</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T10:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585572#M167015</link>
      <description>&lt;P&gt;Simply replace 'string' with 'address'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input address $200.;
datalines;
FULLNAMEMackenzie M. ThompsonADDRESS60 Boroughbridge RoadTOWNBIRKHALLPOSTCODEAB35 3LW
FULLNAMEEvelyn F. HillADDRESS18 St James BoulevardTOWNHORSEBROOKPOSTCODEST19 5EQ
FULLNAMEElise R. HayADDRESS15 Sloe LaneTOWNCROSTHWAITEPOSTCODELA8 6TP
FULLNAMEAntonia M. HendersonADDRESS3 Exning RoadTOWNHARLEYHOLMPOSTCODEML12 2JZ
;

data want(drop=p);
    set have;
    housenum=input(compress(scan(address, 3), '', 'kd'), 8.);
    p=index(address,"POSTCODE");
    postcode=substr(address, p+9, length(address)-p);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585572#M167015</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T10:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585574#M167016</link>
      <description>Thanks for your reply - my example was just a partial extract of the variable, Address, which contains thousands of observations and means that using datalines may not be the best method for me. Is there a method that looks at an observation from the Address variable, instead of using datalines? Thanks!</description>
      <pubDate>Mon, 02 Sep 2019 10:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585574#M167016</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T10:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585575#M167017</link>
      <description>&lt;P&gt;I do not suggest that you use datalines in your actual case. Simply use my code as a template and do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- insert your actual data set name instead of &lt;STRONG&gt;have&amp;nbsp;&lt;/STRONG&gt;in the set statement&lt;/P&gt;
&lt;P&gt;- Insert the appropriate variable name (if your actual variable is named &lt;STRONG&gt;Address&lt;/STRONG&gt;, then you're good.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 10:32:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585575#M167017</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T10:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585577#M167018</link>
      <description>&lt;P&gt;Thanks for your code, I've excluded your first part (with the datalines) and it works. Do you mean explaining what is happening for &lt;FONT color="#ff0000"&gt;each&lt;/FONT&gt; &lt;FONT color="#ff0000"&gt;line of code&amp;nbsp;&lt;/FONT&gt;i.e. &lt;FONT color="#ff0000"&gt;housenum&lt;/FONT&gt; (in particular what &lt;FONT color="#ff0000"&gt;''&lt;/FONT&gt; is doing from &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;compress&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;address&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;''&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'kd'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;8&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;), &lt;FONT color="#ff0000"&gt;p&lt;/FONT&gt; (what is the purpose of the variable p, as it gives an output of 70 and 65 for the first two observations, for example) and &lt;FONT color="#ff0000"&gt;postcode&lt;/FONT&gt; are doing in plain English, so I can understand what processes are happening? Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 11:05:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585577#M167018</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T11:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585580#M167020</link>
      <description>&lt;P&gt;No problem &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;housenum&lt;/STRONG&gt; from the inside out:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;address&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; The third word in the string&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token function"&gt;compress&lt;/SPAN&gt;(&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;(&lt;SPAN&gt;address&lt;/SPAN&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;),&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;''&lt;/SPAN&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'kd'&lt;/SPAN&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; keep only digits ('kd') from the third word of the string.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="token punctuation"&gt;Input(..., 8.): Convert the above found string to a numeric value.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="token punctuation"&gt;p:&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="token punctuation"&gt;index(address,"POSTCODE") finds the position in the string where the substring POSTCODE first appears.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="token punctuation"&gt;postcode:&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="token punctuation"&gt;substr(address, p+9, length(address)-p) extracts a substring from address starting from p+9 (9 because POSTCODE has 8 characters and we want the next character from there). From that character we read forward length(address)-p&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 11:07:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585580#M167020</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T11:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585582#M167022</link>
      <description>Thanks a lot!</description>
      <pubDate>Mon, 02 Sep 2019 11:13:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585582#M167022</guid>
      <dc:creator>jeremy4</dc:creator>
      <dc:date>2019-09-02T11:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Substring to extract house number and post code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585583#M167023</link>
      <description>&lt;P&gt;Anytime &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2019 11:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Substring-to-extract-house-number-and-post-code/m-p/585583#M167023</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-09-02T11:15:53Z</dc:date>
    </item>
  </channel>
</rss>

