<?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 Import File in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41820#M8583</link>
    <description>Suggest the OP search the SAS support website for additional info.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Insufficient authorization to access PIPE site:sas.com</description>
    <pubDate>Tue, 07 Jun 2011 17:21:54 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2011-06-07T17:21:54Z</dc:date>
    <item>
      <title>SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41812#M8575</link>
      <description>I have following SAS code that looks for "DailySales" files and import daily sales data into SAS data set.  What i would like to do is the code to search for the "DailySales" files and if it doesn't find the "DailySales" files then use the "DailyImport" file.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
Data work.DailySales ;&lt;BR /&gt;
INFILE "C:\DailySales"&lt;BR /&gt;
LRECL=143&lt;BR /&gt;
ENCODING="WLATIN1"&lt;BR /&gt;
TERMSTR=CRLF&lt;BR /&gt;
TRUNCOVER ;&lt;BR /&gt;
.....&lt;BR /&gt;
[/pre]</description>
      <pubDate>Thu, 31 Mar 2011 13:48:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41812#M8575</guid>
      <dc:creator>newbi</dc:creator>
      <dc:date>2011-03-31T13:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41813#M8576</link>
      <description>the infile option FILEVAR= allows you to define the physical file name at runtime ( so, after you check that the file exists). &lt;BR /&gt;
The FILEEXIST() function allows your data step to decide which to read</description>
      <pubDate>Sun, 03 Apr 2011 02:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41813#M8576</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-04-03T02:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41814#M8577</link>
      <description>Hi.Another choice is to use filename + pipe.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename file pipe 'dir C:\DailySales /B';&lt;BR /&gt;
&lt;BR /&gt;
data temp;&lt;BR /&gt;
 infile file truncover;&lt;BR /&gt;
 input fname $20.;&lt;BR /&gt;
 fname=coalesce(fname,'DailyImport');&lt;BR /&gt;
......&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 06 Apr 2011 09:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41814#M8577</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-06T09:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41815#M8578</link>
      <description>Thanks for all reply.  I will try both methods.</description>
      <pubDate>Wed, 06 Apr 2011 16:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41815#M8578</guid>
      <dc:creator>newbi</dc:creator>
      <dc:date>2011-04-06T16:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41816#M8579</link>
      <description>Hi.&lt;BR /&gt;
Sorry.My code is wrong.&lt;BR /&gt;
It is my fault that not test it. Please ignore me.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 07 Apr 2011 01:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41816#M8579</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-07T01:00:29Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41817#M8580</link>
      <description>OK.I will give you a solution.The following code is right. I test it by myself.&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let path=c:\;&lt;BR /&gt;
filename fname pipe "dir &amp;amp;path.dailysales.txt &amp;amp;path.dailyimport.txt /B";&lt;BR /&gt;
data want;&lt;BR /&gt;
 infile fname truncover;&lt;BR /&gt;
 input fname $20.;&lt;BR /&gt;
 fname="&amp;amp;path"||fname;&lt;BR /&gt;
 infile dummy filevar=fname end=last length=len;&lt;BR /&gt;
 do until( last);&lt;BR /&gt;
  input row $varying200. len;&lt;BR /&gt;
  output;&lt;BR /&gt;
  if last then stop;&lt;BR /&gt;
 end;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Mon, 11 Apr 2011 01:27:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41817#M8580</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-11T01:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41818#M8581</link>
      <description>Ksharp,&lt;BR /&gt;
&lt;BR /&gt;
I'm using unix and getting error for using pipe:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Insufficient authorization to access PIPE.&lt;BR /&gt;
&lt;BR /&gt;
%let path="/mnt/data/";&lt;BR /&gt;
filename fname pipe "/mnt/data/ &amp;amp;path.dailysales.txt &amp;amp;path.dailyimport.txt /B";</description>
      <pubDate>Tue, 07 Jun 2011 14:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41818#M8581</guid>
      <dc:creator>newbi</dc:creator>
      <dc:date>2011-06-07T14:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41819#M8582</link>
      <description>There could be a number of reasons. From where are you running this code? Base SAS, EGuide?&lt;BR /&gt;
&lt;BR /&gt;
If you are running it from Eguide, it may be that the object spawner is not allowed to execute external OS commands. You will need to add a NONOXCMD to the object spawner startup command.&lt;BR /&gt;
&lt;BR /&gt;
Just looked again at your code. What exactly are you trying to do in the PIPE statement? You are missing the DIR in the filename statement.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: RMP

Message was edited by: RMP</description>
      <pubDate>Tue, 07 Jun 2011 14:50:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41819#M8582</guid>
      <dc:creator>RMP</dc:creator>
      <dc:date>2011-06-07T14:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41820#M8583</link>
      <description>Suggest the OP search the SAS support website for additional info.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
Suggested Google advanced search argument, this topic / post:&lt;BR /&gt;
&lt;BR /&gt;
ERROR: Insufficient authorization to access PIPE site:sas.com</description>
      <pubDate>Tue, 07 Jun 2011 17:21:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41820#M8583</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2011-06-07T17:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41821#M8584</link>
      <description>Under Unix, you should use ' ls ' command to check the list of directory.&lt;BR /&gt;
But from your log, it is to say you do not have right to use PIPE functionality.&lt;BR /&gt;
If you can ,contact with SAS Administrator, to see whether to open it for you.&lt;BR /&gt;
If you can not ,can refer to the SAS code which used fopen() function written by SASKiWi at previous post.&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 08 Jun 2011 02:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41821#M8584</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-08T02:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Import File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41822#M8585</link>
      <description>Or you can code like this.But need to change the path into unix (/mnt/data/trans.txt)&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
filename a 'c:\trans.txt';&lt;BR /&gt;
&lt;BR /&gt;
%let a=%sysfunc(fexist(a) );&lt;BR /&gt;
&lt;BR /&gt;
%macro imp;&lt;BR /&gt;
%if &amp;amp;a=1 %then %do;&lt;BR /&gt;
proc import datafile='c:\trans.txt' out=want dbms=tab replace;&lt;BR /&gt;
                                               getnames=yes;&lt;BR /&gt;
run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%else %do;&lt;BR /&gt;
proc import datafile='c:\dailysales.txt' out=want dbms=tab replace;&lt;BR /&gt;
                                               getnames=yes;&lt;BR /&gt;
run;&lt;BR /&gt;
%end;&lt;BR /&gt;
%mend imp;&lt;BR /&gt;
&lt;BR /&gt;
%imp&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Wed, 08 Jun 2011 03:08:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Import-File/m-p/41822#M8585</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-06-08T03:08:49Z</dc:date>
    </item>
  </channel>
</rss>

