<?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: Save SAS program in PDF format with header - Data step problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879800#M347572</link>
    <description>&lt;P&gt;If the question is how to convert a text file that looks like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Some title */
data class ;
  input Name $ Sex :$1. Age Height Weight;
cards;
Alfred M 14 69 112.5
Alice F 13 56.5 84
Barbara F 13 65.3 98
Carol F 14 62.8 102.5
Henry M 14 63.5 102.5
James M 12 57.3 83
Jane F 12 59.8 84.5
Janet F 15 62.5 112.5
Jeffrey M 13 62.5 84
/* Some title */
John M 12 59 99.5
Joyce F 11 51.3 50.5
Judy F 14 64.3 90
Louise F 12 56.3 77
Mary F 15 66.5 112
Philip M 16 72 150
Robert M 12 64.8 128
Ronald M 15 67 133
Thomas M 11 57.5 85
William M 15 66.5 112
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Into&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class ;
  input Name $ Sex :$1. Age Height Weight;
cards;
Alfred M 14 69 112.5
Alice F 13 56.5 84
Barbara F 13 65.3 98
Carol F 14 62.8 102.5
Henry M 14 63.5 102.5
James M 12 57.3 83
Jane F 12 59.8 84.5
Janet F 15 62.5 112.5
Jeffrey M 13 62.5 84
John M 12 59 99.5
Joyce F 11 51.3 50.5
Judy F 14 64.3 90
Louise F 12 56.3 77
Mary F 15 66.5 112
Philip M 16 72 150
Robert M 12 64.8 128
Ronald M 15 67 133
Thomas M 11 57.5 85
William M 15 66.5 112
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then perhaps you just need to look for that TITLE line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'file pulled form pdf.txt' ;
 file 'myprogram.sas';
 input;
  if _infile_= '/* Some title */' then delete;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jun 2023 16:38:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2023-06-08T16:38:24Z</dc:date>
    <item>
      <title>Save SAS program in PDF format with header - Data step problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879725#M347546</link>
      <description>&lt;P&gt;As part of our business, we need to save our SAS programs in PDF format with a header.&lt;/P&gt;&lt;P&gt;We would then like to be able to copy paste the program from the PDF to SAS and run it without having to modify it.&lt;/P&gt;&lt;P&gt;For this, the headers of the created PDFs are between "/* */" so that they are commented in the program and therefore do not interfere with its execution. However, this causes problems when this header falls in the middle of a data step, because comments in this format are not valid in datalines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you have an idea / solution to either allow comments in a data step, or guarantee that the data steps are never on several PDF pages?&lt;/P&gt;&lt;P&gt;Indeed, the PDF is created automatically by the following code:&lt;/P&gt;&lt;PRE&gt;title j=l "/* header */";&lt;BR /&gt;ods pdf file="location" style=define_style;&lt;BR /&gt;filename sas "location.sas";&lt;BR /&gt;data _null_;&lt;BR /&gt;infile sas expandtabs;&lt;BR /&gt;input;&lt;BR /&gt;temp =_infile_;&lt;BR /&gt;file print ods=(template="PDF");&lt;BR /&gt;put _ods_;&lt;BR /&gt;run;&lt;BR /&gt;ods pdf close;&lt;/PRE&gt;&lt;P&gt;Thks for your response.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 10:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879725#M347546</guid>
      <dc:creator>Tiffanie</dc:creator>
      <dc:date>2023-06-08T10:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Save SAS program in PDF format with header - Data step problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879727#M347548</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/398500"&gt;@Tiffanie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;As part of our business, we need to save our SAS programs in PDF format with a header.&lt;/P&gt;
&lt;P&gt;We would then like to be able to copy paste the program from the PDF to SAS and run it without having to modify it.&lt;/P&gt;
&lt;P&gt;For this, the headers of the created PDFs are between "/* */" so that they are commented in the program and therefore do not interfere with its execution. However, this causes problems when this header falls in the middle of a data step, because comments in this format are not valid in datalines.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you have an idea / solution to either allow comments in a data step, or guarantee that the data steps are never on several PDF pages?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Comments cannot be in DATALINES and so the only suggestion I have is to put the comments before the DATALINES. This really has nothing to do with PDF at all.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 11:24:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879727#M347548</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-08T11:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Save SAS program in PDF format with header - Data step problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879729#M347550</link>
      <description>&lt;P&gt;Code meant&amp;nbsp;&lt;EM&gt;to be used&lt;/EM&gt; should always be stored in simple text files (.sas).&lt;/P&gt;
&lt;P&gt;The only times I put SAS codes in pdf files was for presentation papers, and there the code examples are usually short, and filtering out page breaks poses no great work for those copying the code.&lt;/P&gt;
&lt;P&gt;Versioning software will also work with simple text only; such software will usually allow you to define a plugin for automatic export to pdf for display purposes.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 11:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879729#M347550</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-08T11:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: Save SAS program in PDF format with header - Data step problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879773#M347565</link>
      <description>&lt;P&gt;"Comments" in data lines really are not such. They are considered values to read. The way to place a "comment" in a datalines block is to place the text where the INPUT statement will not read it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Data example;
  input x y;
datalines;
1 2
1 3
4 5   /* this is imitating a comment in data lines because Input is not reading it*/
;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 14:38:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879773#M347565</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-08T14:38:45Z</dc:date>
    </item>
    <item>
      <title>Re: Save SAS program in PDF format with header - Data step problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879800#M347572</link>
      <description>&lt;P&gt;If the question is how to convert a text file that looks like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Some title */
data class ;
  input Name $ Sex :$1. Age Height Weight;
cards;
Alfred M 14 69 112.5
Alice F 13 56.5 84
Barbara F 13 65.3 98
Carol F 14 62.8 102.5
Henry M 14 63.5 102.5
James M 12 57.3 83
Jane F 12 59.8 84.5
Janet F 15 62.5 112.5
Jeffrey M 13 62.5 84
/* Some title */
John M 12 59 99.5
Joyce F 11 51.3 50.5
Judy F 14 64.3 90
Louise F 12 56.3 77
Mary F 15 66.5 112
Philip M 16 72 150
Robert M 12 64.8 128
Ronald M 15 67 133
Thomas M 11 57.5 85
William M 15 66.5 112
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Into&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class ;
  input Name $ Sex :$1. Age Height Weight;
cards;
Alfred M 14 69 112.5
Alice F 13 56.5 84
Barbara F 13 65.3 98
Carol F 14 62.8 102.5
Henry M 14 63.5 102.5
James M 12 57.3 83
Jane F 12 59.8 84.5
Janet F 15 62.5 112.5
Jeffrey M 13 62.5 84
John M 12 59 99.5
Joyce F 11 51.3 50.5
Judy F 14 64.3 90
Louise F 12 56.3 77
Mary F 15 66.5 112
Philip M 16 72 150
Robert M 12 64.8 128
Ronald M 15 67 133
Thomas M 11 57.5 85
William M 15 66.5 112
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then perhaps you just need to look for that TITLE line.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'file pulled form pdf.txt' ;
 file 'myprogram.sas';
 input;
  if _infile_= '/* Some title */' then delete;
  put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jun 2023 16:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Save-SAS-program-in-PDF-format-with-header-Data-step-problem/m-p/879800#M347572</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-08T16:38:24Z</dc:date>
    </item>
  </channel>
</rss>

