<?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: Assigning data types in PROC SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257675#M49492</link>
    <description>&lt;P&gt;Worked like a charm! Thank you very much!&lt;/P&gt;</description>
    <pubDate>Fri, 18 Mar 2016 18:22:11 GMT</pubDate>
    <dc:creator>PhatRam33</dc:creator>
    <dc:date>2016-03-18T18:22:11Z</dc:date>
    <item>
      <title>Assigning data types in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257670#M49489</link>
      <description>&lt;P&gt;I'm using PROC SQL and my question is what is the correct syntax to assign a dataype to a field?&amp;nbsp; Kept receiving errors when trying to run this piece of code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a simplified example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;create&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;table&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; work.test2 &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;t1.activity_type varchar(&lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;50&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;) &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;from&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;work.test &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;as&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; t1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;Thanks in advance &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 17:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257670#M49489</guid>
      <dc:creator>PhatRam33</dc:creator>
      <dc:date>2016-03-18T17:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning data types in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257672#M49490</link>
      <description>&lt;P&gt;If you just select an existing variable it keeps the same type as the source table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To convert it, in SAS use INPUT/PUT to convert.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a database language this would be the equivalent of CAST or TO_CHAR functions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;put(t1.activity_type, $50.)  as activity_type&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Mar 2016 17:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257672#M49490</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-18T17:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Assigning data types in PROC SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257675#M49492</link>
      <description>&lt;P&gt;Worked like a charm! Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 18 Mar 2016 18:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assigning-data-types-in-PROC-SQL/m-p/257675#M49492</guid>
      <dc:creator>PhatRam33</dc:creator>
      <dc:date>2016-03-18T18:22:11Z</dc:date>
    </item>
  </channel>
</rss>

