<?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: filename save to file issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854710#M337811</link>
    <description>&lt;P&gt;How to see and submit the file that is generated? Open the PROGRAM EDITOR window (not the "enhanced" editor), this can be done with "PGM" on the command line, or from one of the menus. Get a command line there and type "include tempsas", that should do it. To submit the code down to the first "quit;" statement, type "subtop &amp;lt;N&amp;gt;", where &amp;lt;N&amp;gt; is the number of the line with the "quit;" statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, there is a menu entry with a list of external file references, I think you can browse the fileref TEMPSAS from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third alternative: instead of using a "TEMP" fileref for TEMPSAS, use a physical file, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tempsas 'c:\temp.sas';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and open that file in your favorite editor after generating the code.&lt;/P&gt;</description>
    <pubDate>Thu, 19 Jan 2023 22:30:19 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2023-01-19T22:30:19Z</dc:date>
    <item>
      <title>filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854624#M337772</link>
      <description>&lt;P&gt;The following code works, but I cannot figure out to solve 2 challenges that arise.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I see or save the file that is generated?&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/35763"&gt;@yabwon&lt;/a&gt;&amp;nbsp;, replacing "temp" with "list" does not show me in the log the content of the file.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And how do I have to mask the macro variable in the %put line?&lt;/P&gt;
&lt;P&gt;It throws out the error:&lt;/P&gt;
&lt;PRE&gt;ERROR: this is not a legal statement.
NOTE: The submitted statements have been canceled.&lt;BR /&gt;158 +%put %NRBQUOTE(&amp;amp;varlist);&lt;BR /&gt;"QMERESIG", "QDEVUELT", "IDEVUELT", "ISALDACR", "IMPSALDO", "ANTIGSAL", "IMPNOMIN", "IMPINTER", "IMPIMSEG", "IMPIMPCU", &lt;BR /&gt;"IMPGADEV", "IMPTOTIM", "IMPOMORA", "IMPCOPRA_GT", "IMPINTER_GT", "IMPCOSEA_GT", "IMPCOIVA_GT", "IMCOCOCA_GT", "IMPOMOCA_GT", &lt;BR /&gt;"IMPPRITR_GT", "IMPINTTR_GT", "IMPIMSTR_GT", "IMPIVATR_GT", "IMPGASTR_GT", "IMPMORTR_GT", "IMPSALDO_GT", "IMPCOPRA_CO", &lt;BR /&gt;"IMPINTER_CO", "IMPCOSEA_CO", "IMPCOIVA_CO", "IMCOCOCA_CO", "IMPOMOCA_CO", "IMPPRITR_CO", "IMPINTTR_CO", "IMPIMSTR_CO", &lt;BR /&gt;"IMPIVATR_CO", "IMPGASTR_CO", "IMPMORTR_CO", "IMPSALDO_CO", "IMPCOPRA_GD", "IMPINTER_GD", "IMPCOSEA_GD", "IMPCOIVA_GD", &lt;BR /&gt;"IMCOCOCA_GD", "IMPOMOCA_GD", "IMPPRITR_GD", "IMPINTTR_GD", "IMPIMSTR_GD", "IMPIVATR_GD", "IMPGASTR_GD", "IMPMORTR_GD", &lt;BR /&gt;"IMPSALDO_GD", "IMPCOPRA_GJ", "IMPINTER_GJ", "IMPCOSEA_GJ", "IMPCOIVA_GJ", "IMCOCOCA_GJ", "IMPOMOCA_GJ", "IMPSALDO_GJ", &lt;BR /&gt;"IMPCOPRA_GJ_MDC", "IMPINTER_GJ_MDC", "IMPCOSEA_GJ_MDC", "IMPCOIVA_GJ_MDC", "IMCOCOCA_GJ_MDC", "IMPOMOCA_GJ_MDC", &lt;BR /&gt;"IMPSALDO_GJ_MDC", "IMPPRITR_GJ", "IMPINTTR_GJ", "IMPIMSTR_GJ", "IMPIVATR_GJ", "IMPGASTR_GJ", "IMPMORTR_GJ", "IMPPRITR_FA", &lt;BR /&gt;"IMPINTTR_FA", "IMPIMSTR_FA", "IMPIVATR_FA", "IMPGASTR_FA", "IMPPRITR_FA_GT", "IMPINTTR_FA_GT", "IMPIMSTR_FA_GT", "IMPIVATR_FA_GT", &lt;BR /&gt;"IMPGASTR_FA_GT", "IMPMORTR_FA_GT", "IMPPRITR_FA_CO", "IMPINTTR_FA_CO", "IMPIMSTR_FA_CO", "IMPIVATR_FA_CO", "IMPGASTR_FA_CO", &lt;BR /&gt;"IMPMORTR_FA_CO", "IMPPRITR_FA_GD", "IMPINTTR_FA_GD", "IMPIMSTR_FA_GD", "IMPIVATR_FA_GD", "IMPGASTR_FA_GD", "IMPMORTR_FA_GD", &lt;BR /&gt;"IMPPRITR_FA_GJ", "IMPINTTR_FA_GJ", "IMPIMSTR_FA_GJ", "IMPIVATR_FA_GJ", "IMPGASTR_FA_GJ", "IMPMORTR_FA_GJ", "SALDOMES", "NUMEQDEV", &lt;BR /&gt;"IMPOQDEV", "IMPORVMG", "FEC_EXPLOTACION", "FEC_CARGA", "SW_CARGADO"&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tempsas temp; /* temporary file, gets deleted when freed or reallocated */
data _null_;
set xdata2;
file tempsas;
put 
/'%let varlist="";'
/'proc cas;'
/'    action columninfo result=r /table={name=' namer  ', caslib="ORACASLIB"};   '
/'    empty = 0;'
/'    if (r.columnInfo.nrows &amp;lt;= 0) then do;'
/'      empty = 1;'
/'      rc = symput("emptyTable", (string)empty);'
/'    end;'
/'    else do;'
/'      columns = "";'
/'        do i = 1 to r.columninfo.nrows;'
/'      if ^index(UPCASE(r["columninfo"][i,4]), "CHAR") or 1=2 THEN do;'
/'            symput("col", quote(r[1,i].column));'
/'            columns = columns||", "||symget("col");'
/'      end;'
/'      end;'
/'      symput("varlist", substrn(columns,2,length(columns)-1));'
/'    end;'
/'run;'
/''
/'quit;'
/'%put %NRBQUOTE(&amp;amp;varlist);';
run;

%include tempsas / source2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:17:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854624#M337772</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-01-19T16:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854629#M337774</link>
      <description>&lt;P&gt;Why do you thing the %PUT statement is the issue?&amp;nbsp; There does not appear to be anything in that macro variable that would require macro quoting.&lt;/P&gt;
&lt;P&gt;So this should work fine:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you thought the value might require macro quoting then use a different method to display the value.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;=varlist;
%put %superq(varlist);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Jan 2023 16:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854629#M337774</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-19T16:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854632#M337776</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;please help me to understand.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In my code-generating data _null_ step I'll later take out the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It's just for control before running the complete code that uses the macro variable as input statement for the variables to use in a cas action set.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That works fine.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put &amp;amp;varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in a code window gives the desired result in the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But why do I get the error message&amp;nbsp;I reported earlier when I run the line?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%include tempsas / source2;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854632#M337776</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-01-19T17:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854634#M337777</link>
      <description>&lt;P&gt;the list&amp;nbsp; will show you the _location_ of the file, so you can inspect it manually,&lt;/P&gt;
&lt;P&gt;or you can do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 infile tempsas;
 input;
 putlog _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to print out content of the file (without running it [like %include does]) in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854634#M337777</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-01-19T17:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854635#M337778</link>
      <description>&lt;P&gt;Look higher in the SAS log for errors.&lt;/P&gt;
&lt;P&gt;Did the DATA _NULL_ step run? How many lines did it write to the file?&lt;/P&gt;
&lt;P&gt;What is the purpose of the data step?&amp;nbsp; It looks very strange as it is reading in a dataset with the SET statement, but it does not appear to be doing anything with the values of read.&amp;nbsp; So the only impact of the SET statement is that the PUT statement will run once for each observation read. And since the PUT statement does not reference any of the variables read from the data set it will write the exact same lines of code to the file multiple times.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 17:24:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854635#M337778</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-01-19T17:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854642#M337781</link>
      <description>&lt;P&gt;This line provokes the error with the %include statement.&lt;/P&gt;
&lt;P&gt;Now I have removed it and it works.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;/''&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I show only the part of the code that has sent me into trouble.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The complete code lists all files in the oracle database, then reads the numeric variables into a macro variable in order to pass it as an argument to several cas actions like the&amp;nbsp;dataPreprocess.rustats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we're talking about several houndreds of files, I had chosen initially a call execute construct but with the cas actions I derailed with the quoting and || stuff.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/76464"&gt;@s_lassen&lt;/a&gt;&amp;nbsp;recommended to use an %include approach instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Related to this project are other posts I created today, i.e. the one seeking to read an oracle table from last obs backwards.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 18:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854642#M337781</guid>
      <dc:creator>acordes</dc:creator>
      <dc:date>2023-01-19T18:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: filename save to file issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854710#M337811</link>
      <description>&lt;P&gt;How to see and submit the file that is generated? Open the PROGRAM EDITOR window (not the "enhanced" editor), this can be done with "PGM" on the command line, or from one of the menus. Get a command line there and type "include tempsas", that should do it. To submit the code down to the first "quit;" statement, type "subtop &amp;lt;N&amp;gt;", where &amp;lt;N&amp;gt; is the number of the line with the "quit;" statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, there is a menu entry with a list of external file references, I think you can browse the fileref TEMPSAS from there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Third alternative: instead of using a "TEMP" fileref for TEMPSAS, use a physical file, e.g.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename tempsas 'c:\temp.sas';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and open that file in your favorite editor after generating the code.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Jan 2023 22:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/filename-save-to-file-issue/m-p/854710#M337811</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2023-01-19T22:30:19Z</dc:date>
    </item>
  </channel>
</rss>

