<?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: Proc export macro for sas dataset to csv in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773294#M245634</link>
    <description>&lt;P&gt;There isn't anything wrong with your program syntax. The most likely cause is you are trying to write the CSVs to your local PC C drive when your SAS session is running on a remote SAS server. This server has no way of identifying your PC C drive. It would help if you posted your SAS log, including the errors, so we can confirm if this is what is happening or not.&lt;/P&gt;</description>
    <pubDate>Sun, 10 Oct 2021 23:41:31 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2021-10-10T23:41:31Z</dc:date>
    <item>
      <title>Proc export macro for sas dataset to csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773292#M245633</link>
      <description>&lt;PRE&gt;%macro export_data;
%do i =1 %to 10;
proc export data=work.out_D&amp;amp;i.
outfile= "C:\Users\export from sas\testD&amp;amp;i..csv"
dbms=csv replace;
PUTNAMES=YES;
run;
%end;
%mend export_data;&lt;/PRE&gt;
&lt;P&gt;Hello there - I am trying to export datasets from SAS to .csv files (a separate .csv file for each dataset) but I am not getting the results and need help to figure out the errors.&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Sara&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 23:01:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773292#M245633</guid>
      <dc:creator>saraphdnz</dc:creator>
      <dc:date>2021-10-10T23:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export macro for sas dataset to csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773294#M245634</link>
      <description>&lt;P&gt;There isn't anything wrong with your program syntax. The most likely cause is you are trying to write the CSVs to your local PC C drive when your SAS session is running on a remote SAS server. This server has no way of identifying your PC C drive. It would help if you posted your SAS log, including the errors, so we can confirm if this is what is happening or not.&lt;/P&gt;</description>
      <pubDate>Sun, 10 Oct 2021 23:41:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773294#M245634</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-10-10T23:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export macro for sas dataset to csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773301#M245636</link>
      <description>&lt;P&gt;The problem is that it is not giving any errors or warnings in the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SAS installed locally and I am not using the remote server.&amp;nbsp; I think the way I call multiple files in the outfile, is not correct and causing the problem&lt;/P&gt;
&lt;PRE&gt;13989  %macro export_data;
13990  %do i =1 %to 10;
13991  proc export data=work.out_D&amp;amp;i.
13992  outfile= "C:\Users\testD&amp;amp;i..csv"
13993  dbms=csv replace;
13994  PUTNAMES=YES;
13995  run;
13996  %end;
13997  %mend export_data;

&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 01:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773301#M245636</guid>
      <dc:creator>saraphdnz</dc:creator>
      <dc:date>2021-10-11T01:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export macro for sas dataset to csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773302#M245637</link>
      <description>&lt;P&gt;All your log is showing is that you defined the macro.&lt;/P&gt;
&lt;P&gt;If you want to macro to generate the code to export a file you need to call the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add these two lines after the %MEND line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
%export_data;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Oct 2021 01:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773302#M245637</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-11T01:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Proc export macro for sas dataset to csv</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773304#M245639</link>
      <description>Thanks, heaps Tom, it worked.</description>
      <pubDate>Mon, 11 Oct 2021 01:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-export-macro-for-sas-dataset-to-csv/m-p/773304#M245639</guid>
      <dc:creator>saraphdnz</dc:creator>
      <dc:date>2021-10-11T01:24:06Z</dc:date>
    </item>
  </channel>
</rss>

