<?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: Export data in macro step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829307#M35517</link>
    <description>&lt;P&gt;Sorry, but i don't understand the problem, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would remove all macro statements and verify that the program does, what it should do. Your macro-variables should not start with an underscore, some automatic variables, like _ClientProjectPath, use the underscore to identify them as automatic variables.&lt;/P&gt;
&lt;P&gt;So the data step would look like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data customer_details;
  set work.installation;
  where Contract = 'Y' AND Colour in ('Red', 'Orange', 'Blue')
    and contract_date_start="01Mar2022"d and contract_date_end="31Aug2022"d;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the export:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data= work.customer_details dbms= xlsx file= "PATH/customer_details.xlsx" replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why do you want a macro at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: code is untested.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 04:43:27 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-08-19T04:43:27Z</dc:date>
    <item>
      <title>Export data in macro step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829305#M35515</link>
      <description>&lt;P&gt;Below is my code. No error running the code, but I want to see the output data. Is there a way to check the output for 'customer_details' from SAS? Also I want to export the data to excel after.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro TECHNOLOGY();&lt;BR /&gt;%let _DT1=2022-03-01;&lt;BR /&gt;%let DT1=%sysfunc(inputn(&amp;amp;_DT1, yymmdd10.), date9.);&lt;BR /&gt;%put &amp;amp;DT1.;&lt;/P&gt;&lt;P&gt;%let _DT2=2022-08-31;&lt;BR /&gt;%let DT2=%sysfunc(inputn(&amp;amp;_DT2, yymmdd10.), date9.);&lt;BR /&gt;%put &amp;amp;DT2.;&lt;/P&gt;&lt;P&gt;data customer_details;&lt;BR /&gt;set work.installation;&lt;BR /&gt;where Contract = 'Y' AND Colour in ('Red', 'Orange', 'Blue')&lt;BR /&gt;and contract_date_start="&amp;amp;dt1"d and contract_date_end="&amp;amp;dt2"d;&lt;BR /&gt;run;&lt;BR /&gt;%mend TECHNOLOGY;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 04:17:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829305#M35515</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-08-19T04:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Export data in macro step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829306#M35516</link>
      <description>&lt;P&gt;I don't understand the question.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just look at the data the same way you would any other SAS dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example you could just use PROC PRINT.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=customer_details;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;There is no need to define a macro to run that code.&amp;nbsp; There is nothing conditional happening there.&amp;nbsp; The %LET statements will work fine as open SAS code instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also there is also no need to set the macro variables to one representation of a date and then convert them to another.&amp;nbsp; Why not just start with the date in a style that will work with the date literals to begin with?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 04:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829306#M35516</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-08-19T04:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: Export data in macro step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829307#M35517</link>
      <description>&lt;P&gt;Sorry, but i don't understand the problem, too.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would remove all macro statements and verify that the program does, what it should do. Your macro-variables should not start with an underscore, some automatic variables, like _ClientProjectPath, use the underscore to identify them as automatic variables.&lt;/P&gt;
&lt;P&gt;So the data step would look like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data customer_details;
  set work.installation;
  where Contract = 'Y' AND Colour in ('Red', 'Orange', 'Blue')
    and contract_date_start="01Mar2022"d and contract_date_end="31Aug2022"d;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now the export:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data= work.customer_details dbms= xlsx file= "PATH/customer_details.xlsx" replace;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why do you want a macro at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note: code is untested.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 04:43:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829307#M35517</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-08-19T04:43:27Z</dc:date>
    </item>
    <item>
      <title>Re: Export data in macro step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829313#M35518</link>
      <description>&lt;P&gt;Thanks for explaining it.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine without having&amp;nbsp;%macro TECHNOLOGY; on the top row.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask why having %macro SAS does not give the output data tab as usual? I realised quite a few of the macro code are doing the same thing.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 07:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829313#M35518</guid>
      <dc:creator>miss2223</dc:creator>
      <dc:date>2022-08-19T07:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Export data in macro step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829329#M35520</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/229416"&gt;@miss2223&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Below is my code. No error running the code, but I want to see the output data. Is there a way to check the output for 'customer_details' from SAS? Also I want to export the data to excel after.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro TECHNOLOGY();&lt;BR /&gt;%let _DT1=2022-03-01;&lt;BR /&gt;%let DT1=%sysfunc(inputn(&amp;amp;_DT1, yymmdd10.), date9.);&lt;BR /&gt;%put &amp;amp;DT1.;&lt;/P&gt;
&lt;P&gt;%let _DT2=2022-08-31;&lt;BR /&gt;%let DT2=%sysfunc(inputn(&amp;amp;_DT2, yymmdd10.), date9.);&lt;BR /&gt;%put &amp;amp;DT2.;&lt;/P&gt;
&lt;P&gt;data customer_details;&lt;BR /&gt;set work.installation;&lt;BR /&gt;where Contract = 'Y' AND Colour in ('Red', 'Orange', 'Blue')&lt;BR /&gt;and contract_date_start="&amp;amp;dt1"d and contract_date_end="&amp;amp;dt2"d;&lt;BR /&gt;run;&lt;BR /&gt;%mend TECHNOLOGY;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many Thanks!!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Perhaps you need to actually call the macro at the end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro TECHNOLOGY();
%let _DT1=2022-03-01;
%let DT1=%sysfunc(inputn(&amp;amp;_DT1, yymmdd10.), date9.);
%put &amp;amp;DT1.;

%let _DT2=2022-08-31;
%let DT2=%sysfunc(inputn(&amp;amp;_DT2, yymmdd10.), date9.);
%put &amp;amp;DT2.;

data customer_details;
set work.installation;
where Contract = 'Y' AND Colour in ('Red', 'Orange', 'Blue')
and contract_date_start="&amp;amp;dt1"d and contract_date_end="&amp;amp;dt2"d;
run;
%mend TECHNOLOGY;
%technology()   /* &amp;lt;-- you have to actually call the macro, like this */&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Aug 2022 11:13:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Export-data-in-macro-step/m-p/829329#M35520</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-08-19T11:13:14Z</dc:date>
    </item>
  </channel>
</rss>

