<?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 a format from a variable when selected in SQL in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505522#M135380</link>
    <description>&lt;P&gt;Ok, thanks.&amp;nbsp; I had thought that might be the case.&amp;nbsp; Its a tad annoying to have to resort to a function call or some logic to avoid, but I suppose its an optional component of the language, not really a SAS part.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Oct 2018 13:13:29 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-10-18T13:13:29Z</dc:date>
    <item>
      <title>Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505508#M135373</link>
      <description>&lt;P&gt;Has anyone had this scenario and found a fix.&amp;nbsp; I have a variable named age coming in from a dataset which has format=4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a proc sql which creates a new dataset and selects this variable.&amp;nbsp; In this instance the format is copied across.&amp;nbsp; Now when a variable is processed in SQL, and no format is applied to the outgoing variable, then the format is missing.&amp;nbsp; Here is an example:&lt;/P&gt;
&lt;PRE&gt;data have;
  attrib age format=4. length=8;
  age=10;
run;

proc sql;
  create table want as
  select age,
         sum(age,0) as want_age
  from   have;
quit;&lt;/PRE&gt;
&lt;P&gt;If you run this you will see age retains the 4. format, but want_age does not have the 4. format applied.&amp;nbsp; I am after the syntax to remove format when I am not processing the variable - as summing 0 in this case should be ok, but would like to avoid processing.&amp;nbsp; Have tried:&lt;/P&gt;
&lt;PRE&gt;create table want (format _all_)...&lt;/PRE&gt;
&lt;PRE&gt;age format=,&lt;/PRE&gt;
&lt;P&gt;Just can't seem to put my finger on the right syntax (if indeed there is one).&amp;nbsp; I am aware that in datastep you can do format _all_, or proc datasets, but the question is can I do it in my existing proc sql step without needing a further step, or is fooling the compiler into creating a new variable the only way?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 12:29:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505508#M135373</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-18T12:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505520#M135378</link>
      <description>&lt;P&gt;There seems to be no way to remove a format with proc sql ,except the one you already found.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 13:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505520#M135378</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2018-10-18T13:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505522#M135380</link>
      <description>&lt;P&gt;Ok, thanks.&amp;nbsp; I had thought that might be the case.&amp;nbsp; Its a tad annoying to have to resort to a function call or some logic to avoid, but I suppose its an optional component of the language, not really a SAS part.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 13:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505522#M135380</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-18T13:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505555#M135389</link>
      <description>&lt;P&gt;SQL can modify format,But I don't know if it is what you are looking for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
proc sql;
  create table want as
  select age,
         sum(age,0) as want_age
  from   have;
  alter table want
   modify age format=best32. ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Oct 2018 14:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505555#M135389</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-10-18T14:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505557#M135390</link>
      <description>&lt;P&gt;Thanks.&amp;nbsp; Its not what I am after though, I would like to remove a format completely, without an additional step.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 14:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505557#M135390</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-10-18T14:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505562#M135394</link>
      <description>&lt;P&gt;Post it as&amp;nbsp;a new feature request.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 14:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505562#M135394</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-18T14:10:05Z</dc:date>
    </item>
    <item>
      <title>Re: Remove a format from a variable when selected in SQL</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505585#M135412</link>
      <description>&lt;P&gt;Good question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Slightly shorter:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select age+0 as age&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(as was suggested by Tom in this 2015 thread:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Procedures/SAS-sql-remove-format/td-p/204704" target="_blank"&gt;SAS sql remove format&lt;/A&gt;&amp;nbsp;and by Howard Schreier -- author of the book "PROC SQL by Example" -- in a 2007 discussion on SAS-L:&amp;nbsp;&lt;A href="https://groups.google.com/forum/#!topic/comp.soft-sys.sas/6FwYeQbi5Ys" target="_blank"&gt;Remove a format via proc sql&lt;/A&gt;, where he also suggested &lt;FONT face="courier new,courier"&gt;trim(&lt;EM&gt;varname&lt;/EM&gt;) as &lt;EM&gt;varname&lt;/EM&gt;&lt;/FONT&gt; for character variables). Others suggested assigning a "neutral" format such as BEST. or $F. in these old discussions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Oct 2018 14:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-a-format-from-a-variable-when-selected-in-SQL/m-p/505585#M135412</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2018-10-18T14:36:05Z</dc:date>
    </item>
  </channel>
</rss>

