<?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: Code for exporting as a step in process in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346955#M22947</link>
    <description>&lt;P&gt;I don't use EG so not sure about the exact terminology, but prompts create macro variables do they not? &amp;nbsp;If so, and you just want a plain Excel file then:&lt;/P&gt;
&lt;PRE&gt;proc export data=abc outtfile="C:\documents\&amp;amp;macro_variable.";
run;&lt;/PRE&gt;
&lt;P&gt;Obviously paths and such like would need to set to your environment and the data= would need to be changed, and if you want nicer output switch to ods tagsets.excelxp.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Apr 2017 08:55:22 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-04-04T08:55:22Z</dc:date>
    <item>
      <title>Code for exporting as a step in process</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346954#M22946</link>
      <description>&lt;P&gt;I'm using EG version 7.13&lt;/P&gt;&lt;P&gt;At the end of a process, I want to export the results as a step in the process. The file should end up on my computer as an Excel file.&lt;/P&gt;&lt;P&gt;I would like to use a prompt to set the name of the exported file, for example "Data from 2017-03", where 2017-03 was entered in my prompt.&lt;/P&gt;&lt;P&gt;How do I do this?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 08:50:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346954#M22946</guid>
      <dc:creator>Pontus</dc:creator>
      <dc:date>2017-04-04T08:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: Code for exporting as a step in process</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346955#M22947</link>
      <description>&lt;P&gt;I don't use EG so not sure about the exact terminology, but prompts create macro variables do they not? &amp;nbsp;If so, and you just want a plain Excel file then:&lt;/P&gt;
&lt;PRE&gt;proc export data=abc outtfile="C:\documents\&amp;amp;macro_variable.";
run;&lt;/PRE&gt;
&lt;P&gt;Obviously paths and such like would need to set to your environment and the data= would need to be changed, and if you want nicer output switch to ods tagsets.excelxp.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 08:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346955#M22947</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-04T08:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: Code for exporting as a step in process</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/347040#M22950</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Using a pop up window to enter a dataset name to export to excel&lt;BR /&gt;&lt;BR /&gt;If you get an error running this, contact your IT department and show them the error and&lt;BR /&gt;ask them to explain why your code did not work?

Link back to this message
https://goo.gl/frqxyy
https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/346954

HAVE (a dataset I want ro export to excel)

    SASHELP.CLASS

WANT (enter the dataset name in a pop up window and export to excel)

+----------------------------------------------+
|COMMAND ===&amp;gt;                                  |
+----------------------------------------------+
|                                              |
| ENTER DATASET NAME   __sahelp.class&amp;lt;ENTER&amp;gt;__ |
|                                              |
+----------------------------------------------+


 d:/xls/class_dosubl.xlsx  (19 obs)

 +------+-----------+------+------+
 |      |    A      |   B  |   C  |
 +------+-----------+------+------+
 |      |           |      |      |
 |    1 |   NAME    |   AGE|  SEX |
 |    2 |   Alfred  |   14 |   M  |
 |    3 |   Alice   |   13 |   F  |
 |    4 |   Barbara |   13 |   F  |
 |    5 |   Carol   |   14 |   F  |
 |    6 |   Henry   |   14 |   M  |
 | ...  |   ...     |  ... | ...  |
 +------------------+------+------+

 [CLASS}


WORKING CODE

         window chose irow=5 rows=25
         #5 @12 "Enter DSN  " dsn $32. attr=underline;
         display chose;

         libname xel "d:/xls/class.xlsx";
         data xel.class_dosubl;

*          _       _   _
 ___  ___ | |_   _| |_(_) ___  _ __
/ __|/ _ \| | | | | __| |/ _ \| '_ \
\__ \ (_) | | |_| | |_| | (_) | | | |
|___/\___/|_|\__,_|\__|_|\___/|_| |_|

;

* note you can pull these dosubl's out but

  This seems more flexible to me.

  1. Save as one stored program or view? (untested)
  2. Could sandwhich a set statement between the two dosubls
  3. Could easily iterate either dosubl?
  4. This encapsulates the code in one address space(depends on how
      sas compiles dosubl - but this is the most powerful implementation)

 

data _null_;

    rc=dosubl('
       data _null_;
         window chose irow=5 rows=25
         #5 @12 "Enter DSN  " dsn $32. attr=underline;
         display chose;
         call symputx("dsn",dsn);
         stop;
       run;quit;
    ');

    rc=dosubl('
      libname xel "d:/xls/class.xlsx";
      data xel.class_dosubl;
         set &amp;amp;dsn (keep=name sex age);
      run;quit;
      libname xel clear;
    ');

 stop;

run;quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Apr 2017 13:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/347040#M22950</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-04-04T13:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Code for exporting as a step in process</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/347173#M22953</link>
      <description>&lt;P&gt;Nice solution&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/42345"&gt;@rogerjdeangelis&lt;/a&gt;. Unfortunately the OP uses EG where WINDOW statements don't work as SAS runs either remotely or in a separate local session. Prompts are the EG alternative.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Apr 2017 20:20:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Code-for-exporting-as-a-step-in-process/m-p/347173#M22953</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-04-04T20:20:55Z</dc:date>
    </item>
  </channel>
</rss>

