<?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: Generate a new .sas file from a sas code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899067#M355372</link>
    <description>&lt;P&gt;I want to create different jobs for different&amp;nbsp; sheets.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Oct 2023 08:21:21 GMT</pubDate>
    <dc:creator>varshabansal</dc:creator>
    <dc:date>2023-10-18T08:21:21Z</dc:date>
    <item>
      <title>Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899062#M355369</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;
&lt;P&gt;I need help please help me, I want write &lt;STRONG&gt;a code to generate a new .sas file from a sas code and a new file at a particular location.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have Extract excel sheet name in sas and want to continue with generate new .sas file from this code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**Assign a libname for excel sheet*/
libname inexcel xlsx '/home/viadmin/casuser/mapping.xlsx';

PROC CONTENTS DATA=inexcel._ALL_ noprint
OUT=Sheets (KEEP=Memname);
RUN;

PROC SORT DATA=Sheets NODUPLICATES;
BY Memname;
RUN;

DATA Sheets;
SET Sheets;
ID=_N_;
RUN;

DATA _NULL_;
IF 0 THEN SET Sheets NOBS=X;
CALL SYMPUT('Recount', X);
STOP;
RUN;


%macro Excel;
%DO i = 1 %TO &amp;amp;Recount;
PROC SQL ;
create table sheet&amp;amp;i. as
SELECT Memname INTO :Name
FROM Sheets WHERE ID = &amp;amp;i;
quit;
%end;
%mend;

%excel;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Till here code is working fine. But after this i want to generate new .sas file for different Names like- sheet1.sas, sheet2.sas&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 07:26:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899062#M355369</guid>
      <dc:creator>varshabansal</dc:creator>
      <dc:date>2023-10-18T07:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899064#M355370</link>
      <description>&lt;P&gt;Why do you want to create a program for each sheet? What will happen in those programs?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 07:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899064#M355370</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-10-18T07:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899065#M355371</link>
      <description>&lt;P&gt;Please post your code for the treatment of one sheet.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:08:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899065#M355371</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-10-18T08:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899067#M355372</link>
      <description>&lt;P&gt;I want to create different jobs for different&amp;nbsp; sheets.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:21:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899067#M355372</guid>
      <dc:creator>varshabansal</dc:creator>
      <dc:date>2023-10-18T08:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899070#M355373</link>
      <description>&lt;P&gt;This is my code:-&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/**Assign a libname for excel sheet*/
libname inexcel xlsx '/home/viadmin/casuser/mapping.xlsx';

PROC CONTENTS DATA=inexcel._ALL_ noprint
OUT=Sheets (KEEP=Memname);
RUN;

PROC SORT DATA=Sheets NODUPLICATES;
BY Memname;
RUN;

DATA Sheets;
SET Sheets;
ID=_N_;
RUN;

DATA _NULL_;
IF 0 THEN SET Sheets NOBS=X;
CALL SYMPUT('Recount', X);
STOP;
RUN;


%macro Excel;
%DO i = 1 %TO &amp;amp;Recount;
PROC SQL ;
create table sheet&amp;amp;i. as
SELECT Memname INTO :Name
FROM Sheets WHERE ID = &amp;amp;i;
quit;
%end;
%mend;

%excel;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;from this i got sheet names- Sheet1,sheet2,&lt;/P&gt;
&lt;P&gt;now i want to generate .sas file for this so that It will be job for sheet.&lt;/P&gt;
&lt;P&gt;like- Job_sheet1.sas , Job_sheet2.sas&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:32:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899070#M355373</guid>
      <dc:creator>varshabansal</dc:creator>
      <dc:date>2023-10-18T08:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899106#M355387</link>
      <description>&lt;P&gt;If you want to make a copy of a .sas file, the easiest way is to use your operating systems, COPY command.&amp;nbsp; If you have options XCMD enabled, you could call this command from SAS.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;But often having multiple programs (one per sheet) to maintain becomes a difficult mess.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you already have one macro in your program, did you consider developing a macro that would process each sheet, rather than creating a separate .sas program for each sheet?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 12:30:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899106#M355387</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-10-18T12:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899125#M355393</link>
      <description>&lt;P&gt;Why do you need one for different sheets? Is the processing different? Is it called under different conditions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 14:48:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899125#M355393</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-10-18T14:48:02Z</dc:date>
    </item>
    <item>
      <title>Re: Generate a new .sas file from a sas code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899334#M355480</link>
      <description>data null;&lt;BR /&gt;%let path=/home;&lt;BR /&gt;%let filename= sheet&amp;amp;i.sas;&lt;BR /&gt;%put &amp;amp;=&amp;amp;path.&amp;amp;filename;&lt;BR /&gt;file= "&amp;amp;path.&amp;amp;filename.";&lt;BR /&gt;put "put line inside the file";&lt;BR /&gt;run;&lt;BR /&gt;</description>
      <pubDate>Fri, 20 Oct 2023 07:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Generate-a-new-sas-file-from-a-sas-code/m-p/899334#M355480</guid>
      <dc:creator>varshabansal</dc:creator>
      <dc:date>2023-10-20T07:12:01Z</dc:date>
    </item>
  </channel>
</rss>

