<?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 Permission error after exporting .csv files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Permission-error-after-exporting-csv-files/m-p/713322#M220046</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to export csv files from our Sasapp server to a shared network drive:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%lET export_directory_RDP = G:\Exports;

%MACRO EXPORTDATA_RDP(DATA);
 %global download_to_rdp download_from;

%let dsempty=0;
data _null_;
  if eof then
    do;
     call symput('dsempty',1);
     put 'NOTE: EOF - no records in data!';
    end;
  stop;
  set &amp;amp;DATA end=eof;
run;

%if &amp;amp;dsempty. %then
    %do;
      %put WARNING: Export step skipped - no output records.;
    %end;
  %else
    %do;
		/* Data to export */
		%let lib  =         work;
		%let datafile =     &amp;amp;DATA;

		/* Local folder to download to */ 
		%let download_to_rdp =  &amp;amp;export_directory_RDP;
		 
		/* detect proper delim for UNIX vs. Windows */
		%let delim=%sysfunc(ifc(%eval(&amp;amp;sysscp. = WIN),\,/));
		 
		/* specify a wildcard to export all csv files*/
		%let download_from =
		  %sysfunc(getoption(work))&amp;amp;delim.%str(*).csv;
		 
		filename src "%sysfunc(getoption(work))&amp;amp;delim.&amp;amp;datafile..csv" encoding = "utf-8";
		 
		proc export data=&amp;amp;lib..&amp;amp;datafile.
		  DBMS = dlm  
		  outfile=src
		  LABEL
		  replace;
			DELIMITER = ";";
		run;

		filename src clear;
    %end;
%MEND;&lt;/PRE&gt;&lt;P&gt;and the following export step:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bouz22_0-1611313628435.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53798i787EFF3EC57528BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bouz22_0-1611313628435.png" alt="bouz22_0-1611313628435.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This works very well but when my colleagues try to open the exported files the get the following error message:&lt;/P&gt;&lt;P&gt;Cannot read file G:/Exports/filename.csv: Permission denied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interestingly, it seems that some files that I exported today have today as creation date while others have the creation date in the past. The files with a creation date in the past do not show the permission error...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have an idea of what is going on here?&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2021 11:11:37 GMT</pubDate>
    <dc:creator>bouz22</dc:creator>
    <dc:date>2021-01-22T11:11:37Z</dc:date>
    <item>
      <title>Permission error after exporting .csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permission-error-after-exporting-csv-files/m-p/713322#M220046</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code to export csv files from our Sasapp server to a shared network drive:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%lET export_directory_RDP = G:\Exports;

%MACRO EXPORTDATA_RDP(DATA);
 %global download_to_rdp download_from;

%let dsempty=0;
data _null_;
  if eof then
    do;
     call symput('dsempty',1);
     put 'NOTE: EOF - no records in data!';
    end;
  stop;
  set &amp;amp;DATA end=eof;
run;

%if &amp;amp;dsempty. %then
    %do;
      %put WARNING: Export step skipped - no output records.;
    %end;
  %else
    %do;
		/* Data to export */
		%let lib  =         work;
		%let datafile =     &amp;amp;DATA;

		/* Local folder to download to */ 
		%let download_to_rdp =  &amp;amp;export_directory_RDP;
		 
		/* detect proper delim for UNIX vs. Windows */
		%let delim=%sysfunc(ifc(%eval(&amp;amp;sysscp. = WIN),\,/));
		 
		/* specify a wildcard to export all csv files*/
		%let download_from =
		  %sysfunc(getoption(work))&amp;amp;delim.%str(*).csv;
		 
		filename src "%sysfunc(getoption(work))&amp;amp;delim.&amp;amp;datafile..csv" encoding = "utf-8";
		 
		proc export data=&amp;amp;lib..&amp;amp;datafile.
		  DBMS = dlm  
		  outfile=src
		  LABEL
		  replace;
			DELIMITER = ";";
		run;

		filename src clear;
    %end;
%MEND;&lt;/PRE&gt;&lt;P&gt;and the following export step:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="bouz22_0-1611313628435.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/53798i787EFF3EC57528BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="bouz22_0-1611313628435.png" alt="bouz22_0-1611313628435.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This works very well but when my colleagues try to open the exported files the get the following error message:&lt;/P&gt;&lt;P&gt;Cannot read file G:/Exports/filename.csv: Permission denied.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Interestingly, it seems that some files that I exported today have today as creation date while others have the creation date in the past. The files with a creation date in the past do not show the permission error...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone have an idea of what is going on here?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 11:11:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permission-error-after-exporting-csv-files/m-p/713322#M220046</guid>
      <dc:creator>bouz22</dc:creator>
      <dc:date>2021-01-22T11:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: Permission error after exporting .csv files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Permission-error-after-exporting-csv-files/m-p/713333#M220053</link>
      <description>&lt;P&gt;It looks like this is actually a problem with moving the files afterwards as they retain the permissions from the previous directory instead of inheriting them from the directory they were moved to..&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2021 12:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Permission-error-after-exporting-csv-files/m-p/713333#M220053</guid>
      <dc:creator>bouz22</dc:creator>
      <dc:date>2021-01-22T12:32:08Z</dc:date>
    </item>
  </channel>
</rss>

