<?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: PROC SQL SAS DOCUMENTATION QUESTION in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156857#M41121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Too much text (my vacation starts tomorrow...), too little sample data.&lt;/P&gt;&lt;P&gt;Can't read anywhere that you run into any issues, have you executed the program, what where the results, and exactly what do you want explained?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Jun 2014 14:49:11 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2014-06-26T14:49:11Z</dc:date>
    <item>
      <title>PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156856#M41120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000;"&gt;Selecting Data from More Than Two Tables&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PAGE 66 of this SAS DOCUMENTATION PDF&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/sqlproc/62086/PDF/default/sqlproc.pdf"&gt;http://support.sas.com/documentation/cdl/en/sqlproc/62086/PDF/default/sqlproc.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you think the code is right at the where clause(in pink below)????&lt;/P&gt;&lt;P&gt;I believe it should have been just&lt;/P&gt;&lt;P&gt;us.Name = pc.Name and&lt;/P&gt;&lt;P&gt;pc.Code = c.State;&lt;/P&gt;&lt;P&gt;Could someone explain to me ??????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql outobs=10;&lt;/P&gt;&lt;P&gt;select us.Capital format=$15., us.Name ’State’ format=$15.,&lt;/P&gt;&lt;P&gt;pc.Code, c.Latitude, c.Longitude&lt;/P&gt;&lt;P&gt;from sql.unitedstates us, sql.postalcodes pc,&lt;/P&gt;&lt;P&gt;sql.uscitycoords c&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff;"&gt;where us.Capital = c.City and&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff;"&gt;us.Name = pc.Name and&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff;"&gt;pc.Code = c.State;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The data that you need could be located in more than two tables. For example, if you&lt;BR /&gt;want to show the coordinates of the capitals of the states in the United States, then you&lt;BR /&gt;need to join the UNITEDSTATES table, which contains the state capitals, with the&lt;BR /&gt;USCITYCOORDS table, which contains the coordinates of cities in the United States.&lt;BR /&gt;Because cities must be joined along with their states for an accurate join (similarly to&lt;BR /&gt;the previous example), you must join the tables on both the city and state columns of&lt;BR /&gt;the tables.&lt;BR /&gt;Joining the cities, by joining the UNITEDSTATES.Capital column to the&lt;BR /&gt;USCITYCOORDS.City column, is straightforward. However, in the UNITEDSTATES&lt;BR /&gt;table the Name column contains the full state name, while in USCITYCOORDS the&lt;BR /&gt;states are specified by their postal code. It is therefore impossible to directly join the&lt;BR /&gt;two tables on their state columns. To solve this problem, it is necessary to use the&lt;BR /&gt;POSTALCODES table, which contains both the state names and their postal codes, as&lt;BR /&gt;an intermediate table to make the correct relationship between UNITEDSTATES and&lt;BR /&gt;USCITYCOORDS. The correct solution joins the UNITEDSTATES.Name column to the&lt;BR /&gt;POSTALCODES.Name column (matching the full state names), and the&lt;BR /&gt;POSTALCODES.Code column to the USCITYCOORDS.State column (matching the&lt;BR /&gt;state postal codes).&lt;BR /&gt;title ’Coordinates of State Capitals’;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql outobs=10;&lt;BR /&gt;select us.Capital format=$15., us.Name ’State’ format=$15.,&lt;BR /&gt;pc.Code, c.Latitude, c.Longitude&lt;BR /&gt;from sql.unitedstates us, sql.postalcodes pc,&lt;BR /&gt;sql.uscitycoords c&lt;BR /&gt;where us.Capital = c.City and&lt;BR /&gt;us.Name = pc.Name and&lt;BR /&gt;pc.Code = c.State;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 14:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156856#M41120</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2014-06-26T14:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156857#M41121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Too much text (my vacation starts tomorrow...), too little sample data.&lt;/P&gt;&lt;P&gt;Can't read anywhere that you run into any issues, have you executed the program, what where the results, and exactly what do you want explained?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 14:49:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156857#M41121</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2014-06-26T14:49:11Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156858#M41122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;I just want to know if what he has in the documentation is right????&lt;/P&gt;&lt;P&gt;based on the columns he merged!!!&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 15:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156858#M41122</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2014-06-26T15:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156859#M41123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is right as we need to coordinates of the capitals of the states.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 15:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156859#M41123</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-06-26T15:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156860#M41124</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;The coding appears to be appropriate.&amp;nbsp; If you open up the Libraries using SAS Explorer and go to the MAPS, MAPSGFK, and MAPSSAS folderS, you will see all(?) the maps library tables.&amp;nbsp; I do not see the tables named in the book, in the library, however someone could have invented them and written it to the 'sql' library that the code is executing.&amp;nbsp; In my experience, the names in map tables are not "coordinated" and the value in a name in one table could be in a completely different name in another table.&amp;nbsp; Perhaps that is what the author was trying to express. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 15:40:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156860#M41124</guid>
      <dc:creator>jwillis</dc:creator>
      <dc:date>2014-06-26T15:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156861#M41125</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try it both ways and see what happens.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 15:44:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156861#M41125</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-26T15:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156862#M41126</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In the last line of the explanation it says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"The correct solution joins the UNITEDSTATES.Name column to the&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;POSTALCODES.Name column (matching the full state names), and the&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;POSTALCODES.Code column to the USCITYCOORDS.State column (matching the&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;state postal codes)."&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I still don't understand why he used &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff00ff;"&gt;where us.Capital = c.City &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff00ff;"&gt;In the table aliased C there is no CITY.........so how is he able to use that variable from C??????&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #ff00ff;"&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 16:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156862#M41126</guid>
      <dc:creator>robertrao</dc:creator>
      <dc:date>2014-06-26T16:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156863#M41127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The documentation shows that column, output 3.12 - that being said, I'm not willing to dig through the entire documentation to find the files etc. &lt;/P&gt;&lt;P&gt;The key is the following section I believe, that is included in the documentation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote" modifiedtitle="true"&gt;
&lt;P&gt;Joining the cities, by joining the UNITEDSTATES.Capital column to the&lt;/P&gt;
&lt;P&gt;USCITYCOORDS.City column, is straightforward. However, in the UNITEDSTATES&lt;/P&gt;
&lt;P&gt;table the Name column contains the full state name, while in USCITYCOORDS the&lt;/P&gt;
&lt;P&gt;states are specified by their postal code. It is therefore impossible to directly join the&lt;/P&gt;
&lt;P&gt;two tables on their state columns. To solve this problem, it is necessary to use the&lt;/P&gt;
&lt;P&gt;POSTALCODES table, which contains both the state names and their postal codes, as&lt;/P&gt;
&lt;P&gt;an intermediate table to make the correct relationship between UNITEDSTATES and&lt;/P&gt;
&lt;P&gt;USCITYCOORDS. The correct solution joins the UNITEDSTATES.Name column to the&lt;/P&gt;
&lt;P&gt;POSTALCODES.Name column (matching the full state names), and the&lt;/P&gt;
&lt;P&gt;POSTALCODES.Code column to the USCITYCOORDS.State column (matching the&lt;/P&gt;
&lt;P&gt;state postal codes).&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 17:10:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156863#M41127</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-06-26T17:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL SAS DOCUMENTATION QUESTION</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156864#M41128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; color: #000000;"&gt;I have placed the relevant parts of the documentation in a separate document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.google.com/document/d/1J2zxTJWRPOiwJtQCluS3n-1FyHYkFJFg3AWEfm1ocyQ/edit?usp=sharing"&gt;SAS SQL Documentation &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; color: #000000;"&gt;You are asking why the constraint:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff; font-size: 19px; font-family: 'Courier New';"&gt;us.Capital = c.City&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; color: #000000;"&gt;is necessary in the where statement. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; color: #000000;"&gt;I will turn this around and ask you to look at what you get if you do not include it. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif; color: #000000;"&gt;You will get all rows where this is true:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P dir="ltr"&gt;&lt;SPAN style="font-size: 19px; font-family: 'Courier New'; color: #ff00ff;"&gt;us.Name = pc.Name and &lt;/SPAN&gt;&lt;SPAN style="color: #ff00ff; font-size: 19px; font-family: 'Courier New';"&gt;pc.Code = c.State;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff00ff; font-size: 19px; font-family: 'Courier New';"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;We have not required that only the&lt;EM&gt; capital cities&lt;/EM&gt; are used.&amp;nbsp; As written we will take all the cities found in the C table.&amp;nbsp; While a city in the C table may not be a state capital, it will still match with the US table by the state.&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 10pt;"&gt;For example the city of Anchorage is found in table C.&amp;nbsp; This select statement will include a row for Anchorage with the state name, the appropriate Postal Code for that state, and its coordinates.&amp;nbsp; It would have a blank for the capital, the first column in the report.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 22:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-SQL-SAS-DOCUMENTATION-QUESTION/m-p/156864#M41128</guid>
      <dc:creator>agdesilva</dc:creator>
      <dc:date>2014-06-26T22:11:58Z</dc:date>
    </item>
  </channel>
</rss>

