<?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: How to check the file exist in particular location in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822211#M324660</link>
    <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is working fine. I will give some more information on my issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue : When ever we are send the request to get the response using proc soap, somtime,&amp;nbsp; I am getting&amp;nbsp; I/O error or Read out time .... So, as per my code, once this error is coming , it will comeout of loop and once again i need to submit the code. But i don't want in this way...It should once again go and access the API untill the response file is created.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Jul 2022 06:01:48 GMT</pubDate>
    <dc:creator>harigottala0</dc:creator>
    <dc:date>2022-07-08T06:01:48Z</dc:date>
    <item>
      <title>How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822105#M324595</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;I am fetch the data through API. for this I am using the proc soap. So, I am send the request file and getting the response file and storing in a particular location. My issue is I need to check that file created based on the size of file and if not i need to run the proc soap still file is created with data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro ac(A=);&lt;/P&gt;&lt;P&gt;%do %until (%EVAL(&amp;amp;fid +0)&amp;gt; 0);&lt;BR /&gt;/* Sending the request to API and getting the response from API using PROC SOAP */&lt;BR /&gt;proc soap&lt;BR /&gt;IN=&amp;amp;w.req&lt;BR /&gt;OUT=&amp;amp;w.resp&lt;BR /&gt;URL="xxxxxxx"&lt;BR /&gt;SOAPACTION="xxxxxxx"&lt;BR /&gt;WEBUSERNAME="xxxx"&lt;BR /&gt;WEBPASSWORD="xxxxxx";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%LET outall=&amp;amp;inpath.&amp;amp;dc._&amp;amp;w._Response1.xml;&lt;BR /&gt;/* To check if the File is exist or not in particular location */&lt;BR /&gt;/* To check file Empty or Non-empty based on the size of the file to further process */&lt;BR /&gt;%let filrf=myfile;&lt;/P&gt;&lt;P&gt;%if %sysfunc(fileexist(&amp;amp;outall)) %then&lt;BR /&gt;%do;&lt;BR /&gt;%let rc=%sysfunc(filename(filrf,&amp;amp;outall));&lt;BR /&gt;%let fid=%sysfunc(fopen(&amp;amp;filrf));&lt;BR /&gt;%put &amp;amp;fid.;&lt;BR /&gt;%if &amp;amp;fid &amp;gt; 0 %then&lt;BR /&gt;%do;&lt;BR /&gt;%let rc=%sysfunc(fread(&amp;amp;fid));&lt;BR /&gt;%let rc=%sysfunc(fget(&amp;amp;fid,mystring));&lt;/P&gt;&lt;P&gt;%if &amp;amp;rc = 0 %then&lt;BR /&gt;%do;&lt;BR /&gt;%put File is Non-Empty;&lt;BR /&gt;%end;&lt;BR /&gt;%else %put File is Empty: Error: I/O Read timed out;&lt;BR /&gt;%let rc=%sysfunc(fclose(&amp;amp;fid));&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%let rc=%sysfunc(filename(filrf));&lt;BR /&gt;%end;&lt;BR /&gt;%else %put file does not exist;&lt;BR /&gt;%end;&lt;BR /&gt;%mend ac;&lt;BR /&gt;%ac(A=1);&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 17:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822105#M324595</guid>
      <dc:creator>harigottala0</dc:creator>
      <dc:date>2022-07-07T17:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822209#M324658</link>
      <description>&lt;P&gt;Some more information will be fine...is your code working, or what's the issue with it?&lt;/P&gt;&lt;P&gt;also, if the file is an xml, you can import it directly to a SAS dataset, by defining a map that defines it's structure (or the part you want to import) and a libname. Once imported, you can check whatever you need. I give you a real example of one of my projects:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;filename rssmap temp;
data _null_;
 infile datalines;
 file rssmap;
 input;
 put _infile_;
 datalines;
&amp;lt;?xml version="1.0" encoding="UTF-8"?&amp;gt;
&amp;lt;SXLEMAP name="RSSMAP" version="2.1"&amp;gt;
  &amp;lt;NAMESPACES count="0"/&amp;gt;
  &amp;lt;TABLE name="item"&amp;gt;
    &amp;lt;TABLE-PATH syntax="XPath"&amp;gt;/sr:codelists/sr:codelist&amp;lt;/TABLE-PATH&amp;gt;
    &amp;lt;COLUMN name="resourceID"&amp;gt;
      &amp;lt;PATH syntax="XPath"&amp;gt;/sr:codelists/sr:codelist/cdomain:id&amp;lt;/PATH&amp;gt;
      &amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;
      &amp;lt;DATATYPE&amp;gt;string&amp;lt;/DATATYPE&amp;gt;
      &amp;lt;LENGTH&amp;gt;800&amp;lt;/LENGTH&amp;gt;
    &amp;lt;/COLUMN&amp;gt;
    &amp;lt;COLUMN name="urn"&amp;gt;
      &amp;lt;PATH syntax="XPath"&amp;gt;/sr:codelists/sr:codelist/cdomain:urn&amp;lt;/PATH&amp;gt;
      &amp;lt;TYPE&amp;gt;character&amp;lt;/TYPE&amp;gt;
      &amp;lt;DATATYPE&amp;gt;string&amp;lt;/DATATYPE&amp;gt;
      &amp;lt;LENGTH&amp;gt;5000&amp;lt;/LENGTH&amp;gt;
    &amp;lt;/COLUMN&amp;gt;
   &amp;lt;/TABLE&amp;gt;
&amp;lt;/SXLEMAP&amp;gt;
;
run;

libname myxml xmlv2 xmlfileref=yourfile xmlmap=rssmap compat=yes;

data codelist;
  set myxml.item;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Hope this helps&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>Fri, 08 Jul 2022 05:40:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822209#M324658</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-08T05:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822211#M324660</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is working fine. I will give some more information on my issue.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue : When ever we are send the request to get the response using proc soap, somtime,&amp;nbsp; I am getting&amp;nbsp; I/O error or Read out time .... So, as per my code, once this error is coming , it will comeout of loop and once again i need to submit the code. But i don't want in this way...It should once again go and access the API untill the response file is created.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 06:01:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822211#M324660</guid>
      <dc:creator>harigottala0</dc:creator>
      <dc:date>2022-07-08T06:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822212#M324661</link>
      <description>&lt;P&gt;So a&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do %while(&amp;amp;rc ne 0)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will do the job, won't it?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 06:19:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822212#M324661</guid>
      <dc:creator>AlexBennasar</dc:creator>
      <dc:date>2022-07-08T06:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822413#M324758</link>
      <description>&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It is not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&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>Sat, 09 Jul 2022 06:16:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822413#M324758</guid>
      <dc:creator>harigottala0</dc:creator>
      <dc:date>2022-07-09T06:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to check the file exist in particular location</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822417#M324760</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step1: Creating the request file.&lt;/P&gt;&lt;P&gt;Step2: Sending the request file to fetch the response file.&lt;/P&gt;&lt;P&gt;proc soap&lt;/P&gt;&lt;P&gt;IN=&amp;amp;w.req&lt;/P&gt;&lt;P&gt;OUT=&amp;amp;w.resp&lt;/P&gt;&lt;P&gt;URL="xxxxxxx"&lt;/P&gt;&lt;P&gt;SOAPACTION="xxxxxxx"&lt;/P&gt;&lt;P&gt;WEBUSERNAME="xxxx"&lt;/P&gt;&lt;P&gt;WEBPASSWORD="xxxxxx";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Step3: Sometime it is creating the non-empty response file (with data), sometimes it is creating the empty response file due to I/O error or Read out time.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harigottala0_0-1657348152834.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73096iB991100CD1E8E07A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="harigottala0_0-1657348152834.png" alt="harigottala0_0-1657348152834.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, as per my code it is coming out of loop and going for next iteration. But I don’t to come out of loop&lt;/P&gt;&lt;P&gt;and go to next iteration unless it create a non-empty response file. If it is empty response file it should go to step2&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2022 06:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-the-file-exist-in-particular-location/m-p/822417#M324760</guid>
      <dc:creator>harigottala0</dc:creator>
      <dc:date>2022-07-09T06:29:47Z</dc:date>
    </item>
  </channel>
</rss>

