<?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: header=no works for PC File Server? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254038#M48399</link>
    <description>&lt;P&gt;Can you use&amp;nbsp;proc import + dbms=excelcs &amp;nbsp;?&lt;/P&gt;</description>
    <pubDate>Thu, 03 Mar 2016 02:58:49 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-03-03T02:58:49Z</dc:date>
    <item>
      <title>header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253748#M48311</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;My SAS and MS Excel have different bit counts so I used&amp;nbsp;&lt;STRONG&gt;PC File Server&lt;/STRONG&gt;&amp;nbsp;to read from an excel file.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the Excel data does not have a header row with variable names so I used&amp;nbsp;&lt;STRONG&gt;header=no&lt;/STRONG&gt;&amp;nbsp;which assigns the default variable names F1, F2, F3. See the code below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname xlsdata pcfiles 'custcaus.xls' header=no;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I run the code above, I get &amp;nbsp;an error message not recognising 'header=no'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;'header=no' cannot be used with pcfiles? if not, what should I use?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;PY&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12336iE4DC6DFD799C0478/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Screen Shot 2016-03-02 at 11.01.42.png" title="Screen Shot 2016-03-02 at 11.01.42.png" /&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:06:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253748#M48311</guid>
      <dc:creator>hoon0338</dc:creator>
      <dc:date>2016-03-02T11:06:23Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253774#M48316</link>
      <description>&lt;P&gt;So your PC Files Server is on the same machine as the SAS session executes, right?&lt;/P&gt;
&lt;P&gt;Have you tried an Excel file with headers, does that work?&lt;/P&gt;
&lt;P&gt;Are you sure about the header= option? I can't find it in the online doc related to PC Files libname.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 12:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253774#M48316</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-02T12:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253775#M48317</link>
      <description>Yes, PC File Server works fine. But when I add “header=no” does not work.&lt;BR /&gt;&lt;BR /&gt;Thanks..&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Mar 2016 12:37:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253775#M48317</guid>
      <dc:creator>hoon0338</dc:creator>
      <dc:date>2016-03-02T12:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253780#M48318</link>
      <description>&lt;P&gt;I don't know the pcfiles libname statement, however have you tried:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;libname xlsdata excel&amp;nbsp;'custcaus.xls' header=no;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As header only seems to be associated with Excel file format, so not pcfiles general.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also, as always, I would suggest saving the data into CSV, and then datastep reading in. &amp;nbsp;Excel is not a good data transfer format.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 12:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253780#M48318</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-02T12:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253783#M48319</link>
      <description>Thanks..&lt;BR /&gt;&lt;BR /&gt;The bit counts of my SAS and MS Office are different so I cannot use ‘excel’ but ‘pcfiles’&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 Mar 2016 12:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253783#M48319</guid>
      <dc:creator>hoon0338</dc:creator>
      <dc:date>2016-03-02T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253791#M48320</link>
      <description>&lt;P&gt;Even more reason to use a proper transfer format like CSV or XML rather than a proprietary software not designed for the purpose.&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 13:06:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/253791#M48320</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-02T13:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254016#M48392</link>
      <description>&lt;P&gt;I have not found a way to do this using the libname statment for pcfiles.&amp;nbsp; However, you do seem to be able to use a proc import using the xlsx dbms engine.&amp;nbsp; I am running SAS 9.4.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Lucida Sans Typewriter" size="1"&gt; proc import datafile = &lt;/FONT&gt;&lt;FONT color="#800080" face="Lucida Sans Typewriter" size="1"&gt;"\\server\AGC-4 Specimen List.xlsx"&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;dbms=xlsx&lt;/P&gt;
&lt;P&gt;out = work.h1 replace;&lt;/P&gt;
&lt;P&gt;getnames=no;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Lucida Sans Typewriter" size="1"&gt;&lt;FONT face="Lucida Sans Typewriter" size="1"&gt; range= &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#800080" face="Lucida Sans Typewriter" size="1"&gt;&lt;FONT color="#800080" face="Lucida Sans Typewriter" size="1"&gt;&lt;FONT color="#800080" face="Lucida Sans Typewriter" size="1"&gt;"NBG-18 Piggyback$A1:B7"n&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Lucida Sans Typewriter" size="1"&gt;&lt;FONT face="Lucida Sans Typewriter" size="1"&gt; ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The xlsx engine seems to avoid the 32bit / 64bit problems and allows the use of getnames=no.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Way at the bottom of this page (link below) is a description of the allowable options for the xlsx dbms engine.&amp;nbsp; This is SAS 9.3, so it may very well depend on what version you are running.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/acpcref/63181/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/acpcref/63181/HTML/default/viewer.htm#n0msy4hy1so0ren1acm90iijxn8j.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good luck.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 Mar 2016 23:35:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254016#M48392</guid>
      <dc:creator>hulllc</dc:creator>
      <dc:date>2016-03-02T23:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254038#M48399</link>
      <description>&lt;P&gt;Can you use&amp;nbsp;proc import + dbms=excelcs &amp;nbsp;?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 02:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254038#M48399</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-03-03T02:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254075#M48413</link>
      <description>Is/will this be a regular delivery? &lt;BR /&gt;If not: add headers to the Excel file manually. &lt;BR /&gt;If yes: require a different file layout from the delivering system/responsible party. And then, like &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; says, try to get a csv file instead.</description>
      <pubDate>Thu, 03 Mar 2016 07:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254075#M48413</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-03-03T07:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254186#M48440</link>
      <description>&lt;P&gt;In response to Ksharp, the excelcs dbms option does not have the option of "getnames=no". &amp;nbsp;So you end up with the first row of the range being made into column names. &amp;nbsp;The xlsx dbms option is the only one that works with the 32 bit/ 64 bit issue and also allows the use of the "getnames=no" option.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 15:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254186#M48440</guid>
      <dc:creator>hulllc</dc:creator>
      <dc:date>2016-03-03T15:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: header=no works for PC File Server?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254195#M48442</link>
      <description>&lt;P&gt;The real point of this exercise is to be able to read an unkown number of sheets of unkown name inside a workbook. &amp;nbsp;By making the Excel workbook a library, you can use proc datasets to write the list of sheets to a SAS table. &amp;nbsp;Then you can use a macro to loop thorugh the table and read all the sheets without having to know before hand how many there are or what their names are. &amp;nbsp;The follow script works. &amp;nbsp;It just seems that once you have established the workbook as a library, you shouldn't have to close the library and use a different approach to access the spreadsheets. &amp;nbsp;However, this does work quite well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;libname mylib pcfiles type=Excel path="\\server\excel.xlsx" ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc datasets library=mylib ;&lt;BR /&gt; contents data=mylib._all_ out=work.sheetlist;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt;create table work.sheets as&lt;BR /&gt;select distinct&lt;BR /&gt;compress(memname, "'") as sheet&lt;BR /&gt;, compress(memname, "'$ -") as table&lt;BR /&gt;from work.sheetlist&lt;BR /&gt;where memname not contains "#Print";&lt;BR /&gt;; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let nsheet=&amp;amp;sqlobs;&lt;/P&gt;
&lt;P&gt;libname mylib clear;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO LOOP;&lt;BR /&gt;%DO i = 1 %TO &amp;amp;nsheet;&lt;/P&gt;
&lt;P&gt;data _NULL_;&lt;BR /&gt; obs=&amp;amp;i ;&lt;BR /&gt; set work.sheets point=obs;&lt;BR /&gt; call symput ('insheet', trim(sheet));&lt;BR /&gt; call symput ('outfile', trim(table));&lt;BR /&gt; stop;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put Now reading &amp;amp;i &amp;amp;insheet to &amp;amp;outfile;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import datafile = "\\server\excel.xlsx"&lt;BR /&gt; dbms=xlsx &lt;BR /&gt; out = work.&amp;amp;outfile replace;&lt;BR /&gt; getnames=no;&lt;BR /&gt; range= "&amp;amp;insheet.A1:B7"n ;&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;%END;&lt;/P&gt;
&lt;P&gt;%MEND loop;&lt;/P&gt;
&lt;P&gt;%LOOP;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Mar 2016 15:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/header-no-works-for-PC-File-Server/m-p/254195#M48442</guid>
      <dc:creator>hulllc</dc:creator>
      <dc:date>2016-03-03T15:27:19Z</dc:date>
    </item>
  </channel>
</rss>

