<?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 a column type when selecting * in proc sql in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613055#M18346</link>
    <description>&lt;P&gt;You can use dataset options to help.&amp;nbsp; &amp;nbsp;So create the new variable using a new name and use the drop= the old variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want(drop=height) as
  select *,put(height,7.3) as height_char
  from sashelp.class
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the new variable to use the original name then add a RENAME= option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want(drop=height rename=(height_char=height)) as
  select *,put(height,7.3) as height_char
  from sashelp.class
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Dec 2019 14:26:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-12-19T14:26:14Z</dc:date>
    <item>
      <title>change a column type when selecting * in proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613041#M18344</link>
      <description>&lt;P&gt;I'm trying to select all the columns from a table and one of those columns I need to change to a numeric type. When I try the following it doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table grand_index as
select
*
,input(MGI_ID, 11.) as MGI_ID format numeric11.
from
LIP.MOSAIC_GRAND_INDEX ; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I'm getting the following warning:&amp;nbsp;WARNING: Variable MGI_ID already exists on file WORK.GRAND_INDEX.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I could simply do the following but then I'm creating a new column which I'm trying to avoid. I would like to get it done in one go&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table grand_index as
	select
		*
		,input(MGI_ID, 11.) as numeric_var format numeric11.
	from
		LIP.MOSAIC_GRAND_INDEX ; 
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 14:10:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613041#M18344</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2019-12-19T14:10:12Z</dc:date>
    </item>
    <item>
      <title>Re: change a column type when selecting * in proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613055#M18346</link>
      <description>&lt;P&gt;You can use dataset options to help.&amp;nbsp; &amp;nbsp;So create the new variable using a new name and use the drop= the old variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want(drop=height) as
  select *,put(height,7.3) as height_char
  from sashelp.class
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want the new variable to use the original name then add a RENAME= option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;create table want(drop=height rename=(height_char=height)) as
  select *,put(height,7.3) as height_char
  from sashelp.class
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2019 14:26:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613055#M18346</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-19T14:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: change a column type when selecting * in proc sql</title>
      <link>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613059#M18348</link>
      <description>&lt;P&gt;thanks, the second option is exactly what I was looking for.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 14:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/change-a-column-type-when-selecting-in-proc-sql/m-p/613059#M18348</guid>
      <dc:creator>Jens89</dc:creator>
      <dc:date>2019-12-19T14:39:03Z</dc:date>
    </item>
  </channel>
</rss>

