<?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 generate separate files one for each by group using ods rtf in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171735#M12329</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Keshan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your response. However, I got this error "ERROR: No logical assign for filename XXXXXXX." when I executed the code below:&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Data collegesummary;&lt;/P&gt;&lt;P&gt;input college $ program $ report $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;LLL Chinese Yes&lt;/P&gt;&lt;P&gt;LLL English No&lt;/P&gt;&lt;P&gt;LLL Spanish Yes&lt;/P&gt;&lt;P&gt;LLL Korean No&lt;/P&gt;&lt;P&gt;Engineering Mechanical Yes&lt;/P&gt;&lt;P&gt;Engineering Chemical Yes&lt;/P&gt;&lt;P&gt;Engineering Electrical No&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dir = "C:\Users\Desktop\";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=collegesummary(keep=college) out=unique nodupkey;by college ;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro repeat(dir=xxxxxxx,dsn=xxxxxxxx,group=xxxxxxxx);&lt;/P&gt;&lt;P&gt;ods rtf path=&amp;amp;dir. file="&amp;amp;dsn&amp;amp;sysdate..rtf" ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=collegesummary nowd;&lt;/P&gt;&lt;P&gt;where college="&amp;amp;group";&lt;/P&gt;&lt;P&gt;column program report;&lt;/P&gt;&lt;P&gt;define program/display;&lt;/P&gt;&lt;P&gt;define report/display;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods rtf close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend repeat;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set unique;&lt;/P&gt;&lt;P&gt; call execute('%repeat(dir=xxxxxxx,dsn='||strip(college)||',group='||strip(college)||')');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;--------------------------&lt;/P&gt;&lt;P&gt;This looks very promising. I'd appreciate any solution to this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 24 May 2014 19:13:03 GMT</pubDate>
    <dc:creator>Carrotbing</dc:creator>
    <dc:date>2014-05-24T19:13:03Z</dc:date>
    <item>
      <title>How to generate separate files one for each by group using ods rtf</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171733#M12327</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have the data like what follows, how do I generate one rtf file for each college automatically?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data collegesummary;&lt;/P&gt;&lt;P&gt;input college $ program $ report $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;LLL Chinese Yes&lt;/P&gt;&lt;P&gt;LLL English No&lt;/P&gt;&lt;P&gt;LLL Spanish Yes&lt;/P&gt;&lt;P&gt;LLL Korean No&lt;/P&gt;&lt;P&gt;Engineering Mechanical Yes&lt;/P&gt;&lt;P&gt;Engineering Chemical Yes&lt;/P&gt;&lt;P&gt;Engineering Electrical No&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use ods.rtf and proc report, how can I create one rtf file for each college. One for LLL and one for engineering?&lt;/P&gt;&lt;P&gt;For LLL college, I have the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods rtf path=&amp;amp;dir.&lt;/P&gt;&lt;P&gt;file="&amp;amp;dsn&amp;amp;sysdate..rtf" ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=collegesummary nowd;&lt;/P&gt;&lt;P&gt;where college="LLL"; &lt;/P&gt;&lt;P&gt;column program report;&lt;/P&gt;&lt;P&gt;define program/display;&lt;/P&gt;&lt;P&gt;define report/display;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods rtf close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I have 20 colleges, I can't do it manually one by one, because I also specified other style options, some of which are specific to the rtf destination.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 May 2014 08:59:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171733#M12327</guid>
      <dc:creator>Carrotbing</dc:creator>
      <dc:date>2014-05-24T08:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate separate files one for each by group using ods rtf</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171734#M12328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Make a macro and repeat it by call execute .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;proc sort data=collegesummary(keep=college) out=unique nodupkey;by college ;run;


%macro repeat(dir=xxxxxxx,dsn=xxxxxxxx,group=xxxxxxxx);
ods rtf path=&amp;amp;dir. file="&amp;amp;dsn&amp;amp;sysdate..rtf" ;
 
proc report data=collegesummary nowd;
where college="&amp;amp;group";
column program report;
define program/display;
define report/display;
run;quit;
 
ods rtf close;


%mend repeat;

data _null_;
 set unique;
 call execute('%repeat(dir=xxxxxxx,dsn='||strip(college)||',group='||strip(college)||')');
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 May 2014 12:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171734#M12328</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-24T12:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate separate files one for each by group using ods rtf</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171735#M12329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Keshan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much for your response. However, I got this error "ERROR: No logical assign for filename XXXXXXX." when I executed the code below:&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Data collegesummary;&lt;/P&gt;&lt;P&gt;input college $ program $ report $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;LLL Chinese Yes&lt;/P&gt;&lt;P&gt;LLL English No&lt;/P&gt;&lt;P&gt;LLL Spanish Yes&lt;/P&gt;&lt;P&gt;LLL Korean No&lt;/P&gt;&lt;P&gt;Engineering Mechanical Yes&lt;/P&gt;&lt;P&gt;Engineering Chemical Yes&lt;/P&gt;&lt;P&gt;Engineering Electrical No&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let dir = "C:\Users\Desktop\";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=collegesummary(keep=college) out=unique nodupkey;by college ;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro repeat(dir=xxxxxxx,dsn=xxxxxxxx,group=xxxxxxxx);&lt;/P&gt;&lt;P&gt;ods rtf path=&amp;amp;dir. file="&amp;amp;dsn&amp;amp;sysdate..rtf" ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc report data=collegesummary nowd;&lt;/P&gt;&lt;P&gt;where college="&amp;amp;group";&lt;/P&gt;&lt;P&gt;column program report;&lt;/P&gt;&lt;P&gt;define program/display;&lt;/P&gt;&lt;P&gt;define report/display;&lt;/P&gt;&lt;P&gt;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods rtf close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend repeat;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; set unique;&lt;/P&gt;&lt;P&gt; call execute('%repeat(dir=xxxxxxx,dsn='||strip(college)||',group='||strip(college)||')');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;--------------------------&lt;/P&gt;&lt;P&gt;This looks very promising. I'd appreciate any solution to this error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 May 2014 19:13:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171735#M12329</guid>
      <dc:creator>Carrotbing</dc:creator>
      <dc:date>2014-05-24T19:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate separate files one for each by group using ods rtf</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171736#M12330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;Data collegesummary;
input college $ program $ report $;
cards;
LLL Chinese Yes
LLL English No
LLL Spanish Yes
LLL Korean No
Engineering Mechanical Yes
Engineering Chemical Yes
Engineering Electrical No
;
run;
 
title;
 
%let dir = "C:\Users\Desktop\";
 
proc sort data=collegesummary(keep=college) out=unique nodupkey;by college ;run;
 
%macro repeat(dir=&amp;amp;dir,dsn=xxxxxxxx,group=xxxxxxxx);
ods rtf&amp;nbsp; file="&amp;amp;dir.&amp;amp;dsn&amp;amp;sysdate..rtf" ;
 
proc report data=collegesummary nowd;
where college="&amp;amp;group";
column program report;
define program/display;
define report/display;
run;quit;
 
ods rtf close;
 
%mend repeat;
 
data _null_;
set unique;
call execute('%repeat(dir=,dsn='||strip(college)||',group='||strip(college)||')');
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 25 May 2014 07:01:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171736#M12330</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-05-25T07:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate separate files one for each by group using ods rtf</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171737#M12331</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It worked. Thank you so much. This is going to be very helpful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yao&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2014 01:46:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/How-to-generate-separate-files-one-for-each-by-group-using-ods/m-p/171737#M12331</guid>
      <dc:creator>Carrotbing</dc:creator>
      <dc:date>2014-05-27T01:46:44Z</dc:date>
    </item>
  </channel>
</rss>

