<?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: How can I use PROC SQL to Select all the NUMERIC Columns in a Table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324595#M72068</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the "Alternatively..." part of your message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_num(keep=_NUMERIC_) want_char(keep=_CHARACTER_);
    set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 13 Jan 2017 15:23:29 GMT</pubDate>
    <dc:creator>gamotte</dc:creator>
    <dc:date>2017-01-13T15:23:29Z</dc:date>
    <item>
      <title>How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324560#M72062</link>
      <description>&lt;P&gt;Using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to split my data set into two subsets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a. All Numeric Variables&lt;/P&gt;&lt;P&gt;b. All Character variables&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I use PROC SQL to Select all the NUMERIC Columns in a Table?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively how would I do this in Base SAS?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 14:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324560#M72062</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2017-01-13T14:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324566#M72066</link>
      <description>&lt;P&gt;Its an odd question. &amp;nbsp;Why would you want to do this? &amp;nbsp;Even if there is a reason surely you would want some sort of identifiers common to both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyways, you can do it, I don't sugest for a moment you should however:&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
  select  distinct NAME 
  into    :NUM_LIST separated by ","
  from    DICTIONARY.COLUMNS
  where   LIBNAME="SASHELP"
    and   MEMNAME="CLASS"
    and   TYPE="num";
  select  distinct NAME 
  into    :CHAR_LIST separated by ","
  from    DICTIONARY.COLUMNS
  where   LIBNAME="SASHELP"
    and   MEMNAME="CLASS"
    and   TYPE ne "num";
  create table WANT_NUM as
  select  &amp;amp;NUM_LIST.
  from    SASHELP.CLASS;
  create table WANT_CHAR as
  select  &amp;amp;CHAR_LIST.
  from    SASHELP.CLASS;
quit;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jan 2017 14:24:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324566#M72066</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-01-13T14:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324595#M72068</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the "Alternatively..." part of your message&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_num(keep=_NUMERIC_) want_char(keep=_CHARACTER_);
    set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jan 2017 15:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324595#M72068</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-13T15:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324596#M72069</link>
      <description>How can I split a data set into two subsets:&lt;BR /&gt;&lt;BR /&gt;a. ID_Variable, All Numeric Variables&lt;BR /&gt;&lt;BR /&gt;b. ID_Variable, All Character Variables&lt;BR /&gt;&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;##- Please type your reply above this line. Simple formatting, no&lt;BR /&gt;attachments. -##</description>
      <pubDate>Fri, 13 Jan 2017 15:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324596#M72069</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2017-01-13T15:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324597#M72070</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question should have been as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="gmail_default"&gt;How can I split a data set into two subsets:&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;a. ID_Variable, All Numeric Variables&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;b. ID_Variable, All Character Variables&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;Thanks for your help.&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="gmail_default"&gt;Regards&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Jan 2017 15:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324597#M72070</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2017-01-13T15:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324599#M72072</link>
      <description>Can you provide SAS code that generates an example of have and want datasets ?</description>
      <pubDate>Fri, 13 Jan 2017 15:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324599#M72072</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2017-01-13T15:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324613#M72078</link>
      <description>&lt;P&gt;Is your ID_variable numeric or character? Assuming character then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data character;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have (keep=_character_);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;Data numeric;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; set have (keep= Id_variable, _numeric_);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;would be easiest as the Id variable would be automatically selected with the character variables.&lt;/P&gt;
&lt;P&gt;If numeric move the id variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 16:08:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324613#M72078</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-13T16:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324764#M72115</link>
      <description>&lt;P&gt;THANK YOU TO ALL THE PEOPLE WHO RESPONDED TO MY QUESTION&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2017 00:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324764#M72115</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2017-01-14T00:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324841#M72142</link>
      <description>&lt;P&gt;RW9 provided a SQL method in response to your original question, here is one for your revised problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table char as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; select *&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; from sashelp.class (keep=_char_)&lt;BR /&gt;&amp;nbsp; ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; create table num as&lt;BR /&gt;&amp;nbsp; &amp;nbsp; select *&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; from sashelp.class (keep=name _numeric_)&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2017 23:29:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324841#M72142</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-14T23:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324842#M72143</link>
      <description>&lt;P&gt;Thank you, there seems to be &amp;nbsp;a close relationship between the simple SQL solution and the Data Step solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2017 23:42:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324842#M72143</guid>
      <dc:creator>JonDickens1607</dc:creator>
      <dc:date>2017-01-14T23:42:42Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324843#M72144</link>
      <description>&lt;P&gt;Of course there is! They're both using SAS. However, you asked for a solution using proc sql which is why I suggested it. Fortunately, with proc sql in SAS, one can use data set options when specifying a file in the "from" clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jan 2017 23:47:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/324843#M72144</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-14T23:47:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I use PROC SQL to Select all the NUMERIC Columns in a Table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/447344#M112358</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;sql&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;select&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; type &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;into&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; :col separated by &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;' '&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;from&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; sashelp.vcolumn&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;/* here libname is library, WORK is the library, name is name of variable created, and, memname is name of dataset */&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;where&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; libname = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'WORK'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; type = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'char'&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;and&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; memname = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'TEST'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 08:39:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-use-PROC-SQL-to-Select-all-the-NUMERIC-Columns-in-a/m-p/447344#M112358</guid>
      <dc:creator>PraviinSNegii</dc:creator>
      <dc:date>2018-03-21T08:39:42Z</dc:date>
    </item>
  </channel>
</rss>

