<?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: Remove format from column via proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844561#M333896</link>
    <description>&lt;P&gt;Using the put function should work. But if you just want to remove a format, using proc datasets is recommended.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2022 06:33:44 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-11-16T06:33:44Z</dc:date>
    <item>
      <title>Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844557#M333893</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;Let's say that I have a char column with format.&lt;/P&gt;
&lt;P&gt;I know that using the sentance FORMAT VAR_NAME&amp;nbsp; will remove the format from the column and the column type will remain same (IF it was char then will stay char and if was numeric then will stay numeric).&lt;/P&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;What is the way to remove format via proc sql?&lt;/P&gt;
&lt;P&gt;I know to use&amp;nbsp;input(Var_NAME,best.)&amp;nbsp; and it remove the format and also convert it to numeric .&lt;/P&gt;
&lt;P&gt;But I just want to remove the format (via proc sql) without change the field type.&lt;/P&gt;
&lt;P&gt;What is the way to do it please?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data t1;
input City $;
cards;
222
333
444
;
Run;

proc format ;
value $fmt
'222'='London'
'333'='Liverpool'
'444'='Leeds'
;
Run;

Data t2;
set t1;
format City $Fmt.;
Run;

Data want1a;
set t2;
format City;/**Remove format from column City: The field stay char**/
Run;


proc sql;
create table want1b as
select input(city,best.) as city /***Remove the format and create numeric field**/
from t2
;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 06:05:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844557#M333893</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-11-16T06:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844561#M333896</link>
      <description>&lt;P&gt;Using the put function should work. But if you just want to remove a format, using proc datasets is recommended.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 06:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844561#M333896</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-11-16T06:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844565#M333900</link>
      <description>&lt;P&gt;If you want to just show your three-digit codes, remove the format with PROC DATASETS and be done with it.&lt;/P&gt;
&lt;P&gt;A numeric variable eats 8 bytes, while you can store the codes in a $ 3 variable. And you will never make calculations with the codes.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 06:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844565#M333900</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-16T06:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844570#M333901</link>
      <description>&lt;P&gt;Thanks, so as far as I understand via proc sql we cannot remove format?(without change column type)&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 07:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844570#M333901</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2022-11-16T07:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844571#M333902</link>
      <description>&lt;P&gt;PROC DATASETS only changes the header page of a dataset, while PROC SQL needs to rewrite the whole dataset.&lt;/P&gt;
&lt;P&gt;That's why PROC DATASETS is the right tool (Maxim 14).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 07:41:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844571#M333902</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-16T07:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Remove format from column via proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844624#M333921</link>
      <description>&lt;P&gt;There is no direct syntax in PROC SQL to do what you can with the FORMAT statement in a data step or proc datasets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot just select it AS something else.&amp;nbsp; PROC SQL remembers the format attached.&amp;nbsp; But if you do some operation on the variable (hopefully something that does not actually change the value) then PROC SQL will "forget" the format (and LABEL and other attributes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  set sashelp.class ;
  format age 4. ;
run;

proc sql ;
create table want as
  select *, age as New_age1, sum(age,.) as New_age2
  from have
;
quit;

proc contents data=want varnum;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1668608217785.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77362i708F76A6D44B3844/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1668608217785.png" alt="Tom_0-1668608217785.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 14:17:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-format-from-column-via-proc-sql/m-p/844624#M333921</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-16T14:17:10Z</dc:date>
    </item>
  </channel>
</rss>

