<?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: Change datatype and length in proc sql in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620669#M77180</link>
    <description>SQL isn't a single thing, there are different versions for each application. Since you're crossing applications here, Teradata and SAS you're actually using two different SQL syntaxes. Everything within the parenthesis/brackets must be Teradata SQL. Everything outside of the parenthesis is SAS SQL. SAS Functions such as PUT() will not work within the parenthesis.</description>
    <pubDate>Tue, 28 Jan 2020 21:23:35 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-01-28T21:23:35Z</dc:date>
    <item>
      <title>Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620293#M77156</link>
      <description>How do i change the length of multiple variables and datatype of variables from numeric to character in sas teradata passthrough sql.&lt;BR /&gt;&lt;BR /&gt;Please check and suggest if the below syntax is correct&lt;BR /&gt;E.g-&lt;BR /&gt;proc sql;&lt;BR /&gt;connect to teradata as tera1 (user=myuser password=mypass server=myserver&lt;BR /&gt;tpt=yes fastexport=yes);&lt;BR /&gt;create table mytable as&lt;BR /&gt;select * from connection to tera1&lt;BR /&gt;(select age,entityno&lt;BR /&gt;,'fbu1' as put(segid) length=10,&lt;BR /&gt;trnsid as put(profgrp_id) length=$30.,accno length=20,startdt length=10,enddt length=10 from mytable&lt;BR /&gt;where age &amp;gt; 15 );&lt;BR /&gt;disconnect from tera1;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Mon, 27 Jan 2020 19:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620293#M77156</guid>
      <dc:creator>nid197</dc:creator>
      <dc:date>2020-01-27T19:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620306#M77157</link>
      <description>Anything within the parenthesis must be Teradata SQL, not SAS SQL. &lt;BR /&gt;&lt;BR /&gt;If you want to change the types, you can do some of it in the location where you currently are selecting *. Instead of * place the fields and specifications needed. &lt;BR /&gt;&lt;BR /&gt;Your method for specifications is wrong though, it should be&lt;BR /&gt;&lt;BR /&gt;select age length=$30. format=$30., put(segid) as fbu1 length=$30. format=$30.  &lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://documentation.sas.com/?docsetId=sqlproc&amp;amp;docsetTarget=n1spf244gkq54cn13bbiy307hknr.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=sqlproc&amp;amp;docsetTarget=n1spf244gkq54cn13bbiy307hknr.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;</description>
      <pubDate>Mon, 27 Jan 2020 19:40:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620306#M77157</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-27T19:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620346#M77159</link>
      <description>&lt;P&gt;The data functions will not work while you are running the code in Teradata using sql pass through. The belw should should give you the desired output. Let me know if this works.&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;connect to teradata as tera1 (user="xxxxxx" password="xxxxxxx" server="xxxxx"&lt;BR /&gt;tpt=yes fastexport=yes);&lt;BR /&gt;create table mytable as&lt;BR /&gt;select * from connection to tera1&lt;BR /&gt;(select age&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,entityno&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cast(segid as varchar(10)) fbu1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cast(profgrp_id as varchar(30)) trnsid&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cast(accno as varchar(20))accno&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cast(startdt as varchar(10)) startdt&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,cast(enddt as varchar(10)) enddt&lt;BR /&gt;from mytable&lt;BR /&gt;where age &amp;gt; 15 );&lt;BR /&gt;disconnect from tera1;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2020 21:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620346#M77159</guid>
      <dc:creator>nirajs</dc:creator>
      <dc:date>2020-01-27T21:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620451#M77171</link>
      <description>Yes you are right length and format statements are not working in teradata passthrough but i dont know why it is giving me problem when i try to use cast to convert character as integer(10).&lt;BR /&gt;Cant i specify length.&lt;BR /&gt;It gives me error as&lt;BR /&gt;Syntax error:expected something between 'integer' and '('.&lt;BR /&gt;Please help</description>
      <pubDate>Tue, 28 Jan 2020 09:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620451#M77171</guid>
      <dc:creator>nid197</dc:creator>
      <dc:date>2020-01-28T09:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620521#M77173</link>
      <description>&lt;P&gt;You don't have to specify length to the numeric columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="ILfuVd"&gt;&lt;SPAN class="e24Kjd"&gt;In SAS, the default length of a numeric variable is 8 bytes. . The limit is NOT 8 digits but 8 bytes. 8 bytes means we can store up to 16 digits for a numeric variable in SAS.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 14:41:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620521#M77173</guid>
      <dc:creator>nirajs</dc:creator>
      <dc:date>2020-01-28T14:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620523#M77174</link>
      <description>&lt;P&gt;you can assign length in Teradata using decimal(10,0) but the SAS dataset you created will still have the length of 8 bytes.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 14:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620523#M77174</guid>
      <dc:creator>nirajs</dc:creator>
      <dc:date>2020-01-28T14:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620669#M77180</link>
      <description>SQL isn't a single thing, there are different versions for each application. Since you're crossing applications here, Teradata and SAS you're actually using two different SQL syntaxes. Everything within the parenthesis/brackets must be Teradata SQL. Everything outside of the parenthesis is SAS SQL. SAS Functions such as PUT() will not work within the parenthesis.</description>
      <pubDate>Tue, 28 Jan 2020 21:23:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620669#M77180</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-01-28T21:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620770#M77188</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/309217"&gt;@nirajs&lt;/a&gt; thankyou for your solution it worked.i am able to change the datatypes and length.but now when i create a new dataset i see a " . " added to the variables data (Eg. 35258. , 79843. , 85246. ) of which i had changed the datatype.is it because the the datatype i gave? Which is "varchar" and there is no character values(only numeric data) but i want it to be char?what is issue can you please help.i hope you undestood my explanation.</description>
      <pubDate>Wed, 29 Jan 2020 08:57:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620770#M77188</guid>
      <dc:creator>nid197</dc:creator>
      <dc:date>2020-01-29T08:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: Change datatype and length in proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620771#M77189</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; thankyou so much:)</description>
      <pubDate>Wed, 29 Jan 2020 08:57:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Change-datatype-and-length-in-proc-sql/m-p/620771#M77189</guid>
      <dc:creator>nid197</dc:creator>
      <dc:date>2020-01-29T08:57:35Z</dc:date>
    </item>
  </channel>
</rss>

