<?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: Quick way to change the data type of registered table in SAS DI 4.9 in SAS Data Science</title>
    <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653939#M8304</link>
    <description>&lt;P&gt;From your reply 'Easiest Way' is not possible. Document says&lt;/P&gt;
&lt;P&gt;'You&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;cannot&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;use the MODIFY clause to&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;change a character column to numeric or vice versa. To change a column's data type, drop the column and then add it (and its data) again, or use the DATA step.'&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Is there a way that I can change the datatype, without dropping the variable?&lt;/P&gt;</description>
    <pubDate>Sat, 06 Jun 2020 21:00:00 GMT</pubDate>
    <dc:creator>David_Billa</dc:creator>
    <dc:date>2020-06-06T21:00:00Z</dc:date>
    <item>
      <title>Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653931#M8302</link>
      <description>&lt;P&gt;I want to change the data type of one of the variable from character to numeric in one of the table in SAS DI 4.9. While I creating the new table, I had mistakenly created one variable with character data type instead of numeric.&lt;/P&gt;
&lt;P&gt;So when I tried to change the datatype by going to respective table via inventory and changed the data type and did right click and choose 'Update Metadata' but still I see the datatype has not changed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ensured that I've closed the table before doing this operation. Am I doing something wrong here or is there any other way to change data type in a step or two?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 20:30:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653931#M8302</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-06-06T20:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653938#M8303</link>
      <description>&lt;P&gt;"&lt;EM&gt;So when I tried to change the datatype by going to respective table via inventory and changed the data type...&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;Here you changed the table metadata but not the underlying physical table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;EM&gt;...and did right click and choose 'Update Metadata'&amp;nbsp;&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;This updates the table metadata using the underlying physical table - which you haven't changed so now metadata for this column will be character again.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Easiest way: Change table metadata, delete the physical table, run the job which creates the physical table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If that's not possible: Use Proc SQL/Alter Table; Modify... and change the physical table. Then execute an update metadata&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 20:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653938#M8303</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-06T20:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653939#M8304</link>
      <description>&lt;P&gt;From your reply 'Easiest Way' is not possible. Document says&lt;/P&gt;
&lt;P&gt;'You&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;cannot&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;use the MODIFY clause to&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;change a character column to numeric or vice versa. To change a column's data type, drop the column and then add it (and its data) again, or use the DATA step.'&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Is there a way that I can change the datatype, without dropping the variable?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 21:00:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653939#M8304</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-06-06T21:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653942#M8305</link>
      <description>&lt;P&gt;&lt;SPAN&gt;'Easiest Way' is to delete the physical table, change your metadata definition, run the DI job that creates the table.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right, you can't change the data type with an alter table. Are you dealing with a SAS table or a database table?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 21:15:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653942#M8305</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-06T21:15:44Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653943#M8306</link>
      <description>It's a SAS table.&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Jun 2020 21:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653943#M8306</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2020-06-06T21:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Quick way to change the data type of registered table in SAS DI 4.9</title>
      <link>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653946#M8307</link>
      <description>&lt;P&gt;OK - if you really can't re-create the table then something as painful as below should do the job. Once you've modified the physical table you then can execute an update metadata and re-align the column throughout your jobs (eventually use the standardization wizard if there are too many impacted mappings).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  var='123';
  output;
  stop;
run;

proc datasets lib=work nolist;
  modify have;
    rename var=_var;
    run;
quit;

proc sql;
  alter table have
    add var float;
  update have
    set var=input(_var,best32.);
  alter table have
    drop _var;
quit;

proc print data=have;
run;
proc contents data=have;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 21:49:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Science/Quick-way-to-change-the-data-type-of-registered-table-in-SAS-DI/m-p/653946#M8307</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-06T21:49:08Z</dc:date>
    </item>
  </channel>
</rss>

