<?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: sas input selected columns in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216677#M53338</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Tom. This is very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Aug 2015 21:09:03 GMT</pubDate>
    <dc:creator>abcd123</dc:creator>
    <dc:date>2015-08-04T21:09:03Z</dc:date>
    <item>
      <title>sas input selected columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216673#M53334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a csv file "abc.csv", it has 5000 variables (var1-var5000, column1 through column5000), and nearly million rows. However I am only interested in var1, var1390,var3782, and var4703. I know I can do it using following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename myfile "abc.csv";&lt;/P&gt;&lt;P&gt;data want(keep=var1 var1390 var3782 var4703);&lt;/P&gt;&lt;P&gt;infile myfile;&lt;/P&gt;&lt;P&gt;input var1-var5000;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the code do waste&amp;nbsp; time inputing those un-wanted columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question is: is there a way to input only wanted columns, i.e. var1, var1390,var3782, and var4703?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 17:38:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216673#M53334</guid>
      <dc:creator>abcd123</dc:creator>
      <dc:date>2015-08-04T17:38:02Z</dc:date>
    </item>
    <item>
      <title>Re: sas input selected columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216674#M53335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is probably not worth the effort.&amp;nbsp; Most of the time will be spent waiting for the disk to move the file into memory.&amp;nbsp; The process of reading in the text version of 5000 variables would be small next to that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 18:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216674#M53335</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-04T18:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: sas input selected columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216675#M53336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IF the file were fixed column then it would be worth determining the columns and reading just those but CSV is going to yield no joy.&lt;/P&gt;&lt;P&gt;Though I would only input variables Var1-var4703;&lt;/P&gt;&lt;P&gt;I suspect you'll need a large value for lrecl as well.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 20:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216675#M53336</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-08-04T20:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: sas input selected columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216676#M53337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you think it is worth the effort then look into some the unix based tools for subsetting CSV files.&lt;/P&gt;&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/7857090/awk-extract-specific-columns-from-delimited-file" title="http://stackoverflow.com/questions/7857090/awk-extract-specific-columns-from-delimited-file"&gt;http://stackoverflow.com/questions/7857090/awk-extract-specific-columns-from-delimited-file&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could wrap your solution inside of a PIPE and read it in SAS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&lt;CODE style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;"&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;filename myfile pipe 'csvfilter &lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;-&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;f &lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;1&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,1&lt;/SPAN&gt;&lt;SPAN class="lit" style="color: #800000;"&gt;390&lt;/SPAN&gt;&lt;SPAN class="pun" style="color: #000000;"&gt;,3782&lt;/SPAN&gt;&lt;SPAN style="color: #800000;"&gt;,4703&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt; abc.&lt;/SPAN&gt;&lt;SPAN class="pln" style="color: #000000;"&gt;csv' ;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt; line-height: 1.5em;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; infile myfile dsd truncover firstobs=2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;&amp;nbsp; input var1 var1390 var3782 var4703;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 12pt;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 20:38:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216676#M53337</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-04T20:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: sas input selected columns</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216677#M53338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Tom. This is very helpful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2015 21:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-input-selected-columns/m-p/216677#M53338</guid>
      <dc:creator>abcd123</dc:creator>
      <dc:date>2015-08-04T21:09:03Z</dc:date>
    </item>
  </channel>
</rss>

