<?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 spatial joining between points and geometry in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901215#M356159</link>
    <description>&lt;P&gt;I have table1 with columns of&amp;nbsp; segment_id, xcoordinate, ycoordinate and I have another table with the columns of segment_id, geometry, wktgeometry. those two tables coming from a SQL databases, My geometries are in char format, my first table contains null values for some values of&amp;nbsp;segment_id. I want to search&amp;nbsp;xcoordinate and ycoordinate&amp;nbsp; inside second table's&amp;nbsp;geometry column to find my missing&amp;nbsp;segment_id in the first table.&lt;/P&gt;
&lt;P&gt;How can i achieve this?&lt;/P&gt;
&lt;P&gt;I had tried following query but getting error,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;segment_id  xcoor    ycoor&lt;BR /&gt;406         28.66968 41.0059921&lt;BR /&gt;416         22.66968 41.3059921&lt;BR /&gt;426         28.66968 41.7159921&lt;BR /&gt;.           31.66968 39.7159921&lt;BR /&gt;&lt;BR /&gt;segment_id, geometry&lt;BR /&gt;426 &lt;SPAN&gt;LINESTRING (28.909554 41.027676, 25.909642 41.3276522, 28.911091 41.02725, 28.9128588 41.0269018, 28.912888 41.026896, 28.912951 41.026884, 28.9129567 41.0268827, 28.91296 41.026882)&lt;BR /&gt;466 LINESTRING (28.909554 41.027676, 28.909642 41.0276522, 28.911091 41,31221)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;
    create table fixed_geoms as
    select a.*, b.wktgeometry,  b.segment_id
    from table1 as a
    left join table2 as b
    on b.segment_id = a.segment_id
    where contains(b.wktgeometry, point(a.xcoordinate, a.ycoordinate));
quit;&lt;/PRE&gt;
&lt;P&gt;The error I faced:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: Function CONTAINS could not be located.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
89   quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.39 seconds
      cpu time            0.03 seconds
      
90   
91   
92   %studio_hide_wrapper;
103  
104  &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 02 Nov 2023 11:00:38 GMT</pubDate>
    <dc:creator>umarigann</dc:creator>
    <dc:date>2023-11-02T11:00:38Z</dc:date>
    <item>
      <title>spatial joining between points and geometry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901215#M356159</link>
      <description>&lt;P&gt;I have table1 with columns of&amp;nbsp; segment_id, xcoordinate, ycoordinate and I have another table with the columns of segment_id, geometry, wktgeometry. those two tables coming from a SQL databases, My geometries are in char format, my first table contains null values for some values of&amp;nbsp;segment_id. I want to search&amp;nbsp;xcoordinate and ycoordinate&amp;nbsp; inside second table's&amp;nbsp;geometry column to find my missing&amp;nbsp;segment_id in the first table.&lt;/P&gt;
&lt;P&gt;How can i achieve this?&lt;/P&gt;
&lt;P&gt;I had tried following query but getting error,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;segment_id  xcoor    ycoor&lt;BR /&gt;406         28.66968 41.0059921&lt;BR /&gt;416         22.66968 41.3059921&lt;BR /&gt;426         28.66968 41.7159921&lt;BR /&gt;.           31.66968 39.7159921&lt;BR /&gt;&lt;BR /&gt;segment_id, geometry&lt;BR /&gt;426 &lt;SPAN&gt;LINESTRING (28.909554 41.027676, 25.909642 41.3276522, 28.911091 41.02725, 28.9128588 41.0269018, 28.912888 41.026896, 28.912951 41.026884, 28.9129567 41.0268827, 28.91296 41.026882)&lt;BR /&gt;466 LINESTRING (28.909554 41.027676, 28.909642 41.0276522, 28.911091 41,31221)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;proc sql;
    create table fixed_geoms as
    select a.*, b.wktgeometry,  b.segment_id
    from table1 as a
    left join table2 as b
    on b.segment_id = a.segment_id
    where contains(b.wktgeometry, point(a.xcoordinate, a.ycoordinate));
quit;&lt;/PRE&gt;
&lt;P&gt;The error I faced:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;ERROR: Function CONTAINS could not be located.
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
89   quit;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.39 seconds
      cpu time            0.03 seconds
      
90   
91   
92   %studio_hide_wrapper;
103  
104  &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 11:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901215#M356159</guid>
      <dc:creator>umarigann</dc:creator>
      <dc:date>2023-11-02T11:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: spatial joining between points and geometry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901248#M356171</link>
      <description>&lt;P&gt;Provide examples of the tables Table1 and Table2 as &lt;STRONG&gt;working &lt;/STRONG&gt;data step code to allow us to create data sets we can test code against. Paste the code into a text box opened on the forum with the &amp;lt;/&amp;gt; icon that appears above the message window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Contains in SAS Proc SQL is looking to see if one sql expression, such as a variable or operation on one or more variables will "contain" as part of the result a specific string value. Example&lt;/P&gt;
&lt;PRE&gt;proc sql;

title 'Most Current Information for Ticket Agents';
   select p.IdNumber,
          coalesce(p2.jobcode,p.jobcode) label='Current Jobcode',
          coalesce(p2.salary,p.salary) label='Current Salary'
      from proclib.payroll p left join proclib.payroll2 p2
      on p.IdNumber=p2.idnum
      where p2.jobcode contains 'TA';&lt;/PRE&gt;
&lt;P&gt;Keeps records in the result with jobcode variable from the data set proclib.payroll2 has 'TA' somewhere in the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have multiple constructs that make me wonder if this is correct part of the forum. I don't find LINESTRING in a search at &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/pgmsashome/home.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/pgmsashome/home.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the linestring is supposed to be map polygon it may be possible to recast this to Proc GINSIDE but I don't have any clue how SQL is supposed to search that linestring and determine a match.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 14:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901248#M356171</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-11-02T14:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: spatial joining between points and geometry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901268#M356178</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have multiple constructs that make me wonder if this is correct part of the forum. I don't find LINESTRING in a search at &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/pgmsashome/home.htm" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/pgmsashome/home.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the linestring is supposed to be map polygon it may be possible to recast this to Proc GINSIDE but I don't have any clue how SQL is supposed to search that linestring and determine a match.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I wonder if the linestring data is coming from SQL server? Apparently it has a&amp;nbsp; linestring object...&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/sql/relational-databases/spatial/linestring?view=sql-server-ver16" target="_blank"&gt;https://learn.microsoft.com/en-us/sql/relational-databases/spatial/linestring?view=sql-server-ver16&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2023 17:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901268#M356178</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-11-02T17:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: spatial joining between points and geometry</title>
      <link>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901678#M356333</link>
      <description>yes it is coming from a postgrsql. Yes it is a linestring and my question here is to look for coordainates inside those linestring.</description>
      <pubDate>Mon, 06 Nov 2023 07:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/spatial-joining-between-points-and-geometry/m-p/901678#M356333</guid>
      <dc:creator>umarigann</dc:creator>
      <dc:date>2023-11-06T07:47:44Z</dc:date>
    </item>
  </channel>
</rss>

