<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355506#M274053</link>
    <description>&lt;P&gt;Please follow the guidance for posting good questions. &amp;nbsp;Steep 1&amp;nbsp;&lt;STRONG&gt;post test data in the form of a datastep&lt;/STRONG&gt;. &amp;nbsp;Then post what the output should look like or describe it. &amp;nbsp;It is very hard to answer anythiing clearerly without knowing what you are working with. &amp;nbsp;Why is it for instance your trying to create a dataset name with data for instance, that is never a good idea. &amp;nbsp;Here is an example using sashelp.class dataset:&lt;/P&gt;
&lt;PRE&gt;proc sort data=sashelp.class out=loop nodupkey;
  by sex;
run;

data _null_;&lt;BR /&gt;  set loop;
  call execute(cats('proc export data=sashelp.class outfile="c:\workbook_for_',sex,'.csv" &lt;BR /&gt;                       replace dbms=csv; 
                       where sex="',sex,'";
                     run;));
run;&lt;/PRE&gt;
&lt;P&gt;What this will do is create a distinct list of sex values, then for each of those values create a proc export of the data, with the name of teh sex parameter, filtered for only that data which is the sex value. &amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 03 May 2017 08:20:26 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-05-03T08:20:26Z</dc:date>
    <item>
      <title>Proc Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355504#M274052</link>
      <description>&lt;P&gt;Hi SAS Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to export the datasets &amp;nbsp;with more than 32 charecters. Actually i am creating a series of macro variables for my dataset and am exporting them with the same macro loop. There are many distinct values in my dataset whic i am exporting and theire length is more than 32 charecters.. Is there is any way to handle this situation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;below is a example code&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select count (distinct name) into : c&lt;BR /&gt;from sashelp.class;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select distinct name into:name1-:name%sysfunc(compress(&amp;amp;c)) from&lt;BR /&gt;sashelp.class;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro a;&lt;BR /&gt;%do i=1 %to &amp;amp;c;&lt;BR /&gt;data ab_&amp;amp;&amp;amp;name&amp;amp;i.;&lt;BR /&gt;set sashelp.class;&lt;BR /&gt;where name="&amp;amp;&amp;amp;name&amp;amp;i."&lt;BR /&gt;run;&lt;BR /&gt;proc export data=ab_&amp;amp;&amp;amp;name&amp;amp;i. outfile="path\ab_&amp;amp;&amp;amp;name&amp;amp;i...csv" dbms=csv replace;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend a;&lt;/P&gt;&lt;P&gt;options symbolgen mprint mlogic;&lt;BR /&gt;%a;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: In my scnerio name have more then 32 charecters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Sanjay.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 08:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355504#M274052</guid>
      <dc:creator>sanjay1</dc:creator>
      <dc:date>2017-05-03T08:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355506#M274053</link>
      <description>&lt;P&gt;Please follow the guidance for posting good questions. &amp;nbsp;Steep 1&amp;nbsp;&lt;STRONG&gt;post test data in the form of a datastep&lt;/STRONG&gt;. &amp;nbsp;Then post what the output should look like or describe it. &amp;nbsp;It is very hard to answer anythiing clearerly without knowing what you are working with. &amp;nbsp;Why is it for instance your trying to create a dataset name with data for instance, that is never a good idea. &amp;nbsp;Here is an example using sashelp.class dataset:&lt;/P&gt;
&lt;PRE&gt;proc sort data=sashelp.class out=loop nodupkey;
  by sex;
run;

data _null_;&lt;BR /&gt;  set loop;
  call execute(cats('proc export data=sashelp.class outfile="c:\workbook_for_',sex,'.csv" &lt;BR /&gt;                       replace dbms=csv; 
                       where sex="',sex,'";
                     run;));
run;&lt;/PRE&gt;
&lt;P&gt;What this will do is create a distinct list of sex values, then for each of those values create a proc export of the data, with the name of teh sex parameter, filtered for only that data which is the sex value. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 08:20:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355506#M274053</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-03T08:20:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355510#M274054</link>
      <description>&lt;P&gt;Using data for filenames always carries the risk of exceeding maximum lengths for names. In the case of files, once the complete filename (including the path) exceeds ~255 (depending on OS) characters, you'll run into a problem with the operating system.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, I would skip the data step that creates the sub-dataset (which might be impossible because dataset names &lt;U&gt;must not&lt;/U&gt; exceed 32 characters), and instead use a where= dataset option in the export step. This will work until the output filename cracks the OS limit.&lt;/P&gt;</description>
      <pubDate>Wed, 03 May 2017 08:27:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Export/m-p/355510#M274054</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-05-03T08:27:09Z</dc:date>
    </item>
  </channel>
</rss>

