<?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: Find path of excel file to import by code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951930#M372088</link>
    <description>Thank you.&lt;BR /&gt;It is true that the file is not in sas server.&lt;BR /&gt;It means that I cannot see the file via sas .&lt;BR /&gt;I can only see the file from the computer local server.&lt;BR /&gt;It is not my decision where to locate these files and currently they are not loacted in sas server location. My question- Is it possible to import csv file that is not located in sas server? What action should I do in order to be able to import it via code?</description>
    <pubDate>Tue, 26 Nov 2024 15:04:43 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2024-11-26T15:04:43Z</dc:date>
    <item>
      <title>Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951895#M372081</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to import EXCEL file that is located in specific location (These are external files that other team create).&lt;/P&gt;
&lt;P&gt;When I am using Import Wizard then all is working well and I succeed import it&amp;nbsp; and I see the code that was created :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data mydata;
INFILE '/usr/local/saswork/SAS_workD18B00007116_LINX107717A14/#LN00389'
        LRECL=91
        ENCODING="HEBREW"
        TERMSTR=CRLF
        DLM='7F'x
        MISSOVER
        DSD ;
    INPUT
        CUST_ID         : $CHAR19.
        Branch     : ?? BEST3.
        Numerator     : $CHAR12.
        Date1   : ?? YYMMDD10.
        Time1     : ?? TIME8.
        Date2     : ?? YYMMDD10.
        Amnt    : ?? COMMA18.
        ProductID     : ?? BEST4. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The issue is that in the future I want to write a code (NOT use Import wizard) that import the file.&lt;/P&gt;
&lt;P&gt;I know that the path that was created (by using import wizard) is a temporary path&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'/usr/local/saswork/SAS_workD18B00007116_LINX107717A14/#LN00389'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When I open Excel file I found the path of the file :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;"//leumisrv1/Shidurim/AFT/Nihul_Sikunim/Credit_Risks/Actimize_Loans_Reports/Loan_Transaction_031124.CSV"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I changed the temporary path to the path that I saw but I see an error that SAS doesnt find this path&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also tried to change the direction on slash (from / to \) and still same error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What should I do please?&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>Tue, 26 Nov 2024 10:13:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951895#M372081</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-26T10:13:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951897#M372082</link>
      <description>&lt;P&gt;First of all you are not importing Excel file, but comma separated text file, &lt;STRONG&gt;CSV&lt;/STRONG&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second thing, because you didn't provide any log/error message/etc. I can only guess...&lt;/P&gt;
&lt;P&gt;When you are doing it through&amp;nbsp; SAS EG (the wizard) you: 1) pick up the file on your local machine {Windows?}, 2) EG moves it to server (makes a copy) and then 3) SAS imports the file on the server.&lt;/P&gt;
&lt;P&gt;If you want to import a file that file &lt;STRONG&gt;has to be visible&lt;/STRONG&gt;&amp;nbsp;to the server you running SAS on!&lt;/P&gt;
&lt;P&gt;So... copy the file on the server and you will be able to import it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 10:57:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951897#M372082</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-11-26T10:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951930#M372088</link>
      <description>Thank you.&lt;BR /&gt;It is true that the file is not in sas server.&lt;BR /&gt;It means that I cannot see the file via sas .&lt;BR /&gt;I can only see the file from the computer local server.&lt;BR /&gt;It is not my decision where to locate these files and currently they are not loacted in sas server location. My question- Is it possible to import csv file that is not located in sas server? What action should I do in order to be able to import it via code?</description>
      <pubDate>Tue, 26 Nov 2024 15:04:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951930#M372088</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-26T15:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951934#M372090</link>
      <description>&lt;P&gt;If you want SAS to import a file, the file has to be stored in a location that is accessible to your SAS server. So it could be stored on the SAS server, or on another server which can can be reached from your SAS server.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When you say you used an Import Wizard to generate the original code, was that an important wizard from Enterprise Guide? If you run Enterprise Guide on a Windows PC and use a wizard to import a file to the SAS session, Enterprise Guide will sometimes upload the file from Windows to the SAS server for you, in the background.&amp;nbsp; It looks like this might be what happened, because the code you shared points to a file in your linux work directory:&lt;/P&gt;
&lt;PRE&gt;INFILE '/usr/local/saswork/SAS_workD18B00007116_LINX107717A14/#LN00389'&lt;/PRE&gt;
&lt;P&gt;But that automatic upload is enterprise guide magic, and it works because enterprise guide is running on your PC, so can see all the files that you can see in Windows.&amp;nbsp; It's not SAS code that is uploading the file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Depending on where the file is stored (windows share? sharepoint? one drive? in the cloud?) there are different options for either automating the process of copying the file to your SAS server, or giving your SAS server access to see the file.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 15:36:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951934#M372090</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2024-11-26T15:36:30Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951937#M372093</link>
      <description>&lt;P&gt;1) "&lt;EM&gt;What action should I do in order to be able to import it via code?&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please forgive me self quoting:&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If you want to import a file that file&amp;nbsp;&lt;STRONG&gt;has to be visible&lt;/STRONG&gt;&amp;nbsp;to the server you running SAS on!&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;So... copy the file on the server and you will be able to import it.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) "&lt;EM&gt;Is it possible to import csv file that is not located in sas server?&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, if a) SAS server can see the file, or b) if the file is accessible by Filename URL statement of Proc Http so it can be downloaded to the server drive.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename f URL "Https://some.web.address.com/location/file.csv" lrecl=1 recfm=n;
filename s "/location/on/my/server/file.csv" lrecl=1 recfm=n;

data _null_;
  rc = fcopy("f","s");
  rctxt=sysmsg();
  if rc then put rctxt;
run;

proc import ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 15:53:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951937#M372093</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-11-26T15:53:32Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951943#M372095</link>
      <description>&lt;P&gt;Enterprise Guide is running on a Windows machine (either yours or some Windows server you connected to) that can access the Windows Share where the file lives.&amp;nbsp; Perhaps that share is the one named \\leumisrv1\Shidurim that you mentioned in your post.&amp;nbsp; Perhaps it is somewhere else, it is whatever location you found it with the Import Wizard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want SAS code to find the file then the server SAS is running on needs access to that file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could ask the SAS administrators to mount the share on the server.&amp;nbsp; If SAS is running on a Unix server then they will mount is at some location in the Unix filesystem tree.&amp;nbsp; So perhaps something like&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/windows_shares/leumisrv1/Shidurim/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could ask for permission to copy the file from some server that has a access.&amp;nbsp; Using something like the unix scp or sftp commands.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 16:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951943#M372095</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-26T16:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951979#M372105</link>
      <description>If I used import wizard and succeed import the file then I think it means that the file is visible by sas? My problem is that I didn't succeed create a code that import it..</description>
      <pubDate>Tue, 26 Nov 2024 19:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951979#M372105</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-26T19:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951980#M372106</link>
      <description>My sas is running on Unix.  How can it help me solve my problem?</description>
      <pubDate>Tue, 26 Nov 2024 19:53:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951980#M372106</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-26T19:53:23Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951981#M372107</link>
      <description>How can I know if the location of file is windows share? sharepoint? one drive? in the cloud</description>
      <pubDate>Tue, 26 Nov 2024 19:54:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951981#M372107</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-26T19:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951984#M372109</link>
      <description>"If I used import wizard and succeed import the file then I think it means that the file is visible by sas?" &lt;BR /&gt;No, it does NOT mean that the file is visible by SAS.&lt;BR /&gt;It only means that (as I wrote in my first response) EG can see the local file and makes a copy of it to the server, so that SAS can import the copy.&lt;BR /&gt;Bart</description>
      <pubDate>Tue, 26 Nov 2024 20:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/951984#M372109</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-11-26T20:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952020#M372116</link>
      <description>Talk to your UNIX Administrator to tell you the real ABSOLUTE PATH of this excel file, and make sure you have READ right when you are using sas to import this excel file.</description>
      <pubDate>Wed, 27 Nov 2024 01:57:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952020#M372116</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-11-27T01:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952029#M372118</link>
      <description>Can you please explain what is ABSOLUTE PATH ? Is it different than the path that I saw when I opened the excel file?</description>
      <pubDate>Wed, 27 Nov 2024 10:26:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952029#M372118</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2024-11-27T10:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952033#M372119</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EG is installed on your local laptop (or eventually something like a Citrix server). From a SAS perspective EG is running on the client machine and connects to a SAS server where SAS code runs.&lt;/P&gt;
&lt;P&gt;When you're using the EG import wizard then from what I understand the EG client on Windows reads the Excel on the client side and uploads the data as text file to SAS WORK. The generated SAS code is for reading this text file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to run SAS code that directly reads an Excel file then such a file needs to be stored under a path that's directly accessible to the SAS Server (unlike with the EG import wizard where you access the file from you local client environment).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not all (or none) shares/mapped drives that are accessible from your laptop will also be accessible from you SAS server. Talk to your SAS admin to figure out if and where there is a location where "PC users" can drop a file that's also accessible to your SAS server.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 11:50:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952033#M372119</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-11-27T11:50:55Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952112#M372132</link>
      <description>ABSOLUTE PATH is like:&lt;BR /&gt;/root/user/ronein/this.xlsx&lt;BR /&gt;&lt;BR /&gt;RELATIVE PATH is like:&lt;BR /&gt;/roneni/this.xlsx&lt;BR /&gt;&lt;BR /&gt;P.S.&lt;BR /&gt;Here /root/ is the ROOT directory in UNIX OS.</description>
      <pubDate>Thu, 28 Nov 2024 01:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952112#M372132</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-11-28T01:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952124#M372136</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;ABSOLUTE PATH is like:&lt;BR /&gt;/root/user/ronein/this.xlsx&lt;BR /&gt;&lt;BR /&gt;RELATIVE PATH is like:&lt;BR /&gt;/roneni/this.xlsx&lt;BR /&gt;&lt;BR /&gt;P.S.&lt;BR /&gt;Here /root/ is the ROOT directory in UNIX OS.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;On UNIX, everything that starts with a slash is an absolute path. So your second example should be&lt;/P&gt;
&lt;PRE&gt;roneni/this.xlsx&lt;/PRE&gt;
&lt;P&gt;so the system would look for a directory called roneni in the current working directory of the calling process.&lt;/P&gt;
&lt;P&gt;The "directory name" for the system root is a single slash.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 11:19:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952124#M372136</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-28T11:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Find path of excel file to import by code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952126#M372138</link>
      <description>&lt;P&gt;On UNIX, an absolute path starts at the system root directory, symbolized by a single slash. Whenever a path is encountered that does not start with a single slash, the system starts to look in the&amp;nbsp;&lt;EM&gt;current working directory&lt;/EM&gt; of the calling process; with a SAS workspace server, this is usually the directory in which the WorkspaceServer.sh script is located, somewhere in the SAS configuration tree.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Nov 2024 11:23:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-path-of-excel-file-to-import-by-code/m-p/952126#M372138</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-11-28T11:23:38Z</dc:date>
    </item>
  </channel>
</rss>

