<?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: create subset in proc sql with selected variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323633#M271220</link>
    <description>&lt;P&gt;Wide data sets make it awkward for query.&lt;/P&gt;
&lt;P&gt;Transpose/normalize your data structure for an easier query and&amp;nbsp;maintenance life.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2017 14:30:32 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2017-01-10T14:30:32Z</dc:date>
    <item>
      <title>create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323565#M271218</link>
      <description>&lt;P&gt;Hi whomsoever it may concern;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Large mobile usauge dataset with 400+ coloums and 10000 observations , from which I have to create a subset with varibles valuse corresponding to the months "June, July and august" using proc sql. How do I can do it? As I know it can be done using macros, But I'm having hard time to do it with proc sql. I do welcome any suggestions or Idea, thank you.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 10:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323565#M271218</guid>
      <dc:creator>JithinJoe</dc:creator>
      <dc:date>2017-01-10T10:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323569#M271219</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please give us a sample of your data (revelant columns) and an example of the desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Daniel Santos&amp;nbsp;@ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 10:54:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323569#M271219</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2017-01-10T10:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323633#M271220</link>
      <description>&lt;P&gt;Wide data sets make it awkward for query.&lt;/P&gt;
&lt;P&gt;Transpose/normalize your data structure for an easier query and&amp;nbsp;maintenance life.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 14:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323633#M271220</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-01-10T14:30:32Z</dc:date>
    </item>
    <item>
      <title>Re: create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323673#M271221</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Not sure I completely understand your data but this will select just month variables.

* sample data;
data have;
retain x1-x5 0;
august ='haveaugust   ';
january='havejanuary  ';
run;quit;

* get month variables;
proc sql;
 select name into :nam separated by ','
 from sashelp.vcolumn
 where   libname='WORK'
     and memname='HAVE'
     and input(cats('01',name,'2016'),anydtdtm.) ne .;
 select &amp;amp;nam from have;
;quit;

AUGUST         JANUARY
----------------------------
haveaugust     havejanuary

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323673#M271221</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-01-10T15:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323684#M271222</link>
      <description>&lt;P&gt;Are the values you are looking for in the values of a single variable or multiple variables (columns if you don't use variable )?&lt;/P&gt;
&lt;P&gt;If a single variable then you maybe looking at something like if the months are text:&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table subset as
   select *
   from have
   where upcase(Monthvariable) in ('JUNE' 'JULY' 'AUGUST');
quit;&lt;/PRE&gt;
&lt;P&gt;If the variable concerned is a SAS date variable (has a format like DATE9. or MMDDYY10. or similar) then&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table subset as
   select *
   from have
   where month(Datevariable) in (6 7 8);
quit;&lt;/PRE&gt;
&lt;P&gt;BUT if you have multiple variables involved we need to know more about the data.&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;
&lt;P&gt;Or did someone give a dataset with column headers like June2015, July2015? If this is the case then the "normalize" comments apply.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 15:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323684#M271222</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-10T15:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: create subset in proc sql with selected variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323689#M271223</link>
      <description>&lt;P&gt;I missunderstood the question&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However it is even easier&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wher &amp;nbsp;input(cats('01',month,'2016''),anydtdtm.) &amp;nbsp;ne .&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2017 16:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-subset-in-proc-sql-with-selected-variables/m-p/323689#M271223</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-01-10T16:02:58Z</dc:date>
    </item>
  </channel>
</rss>

