<?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: Create a data set  after a case when in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571963#M12252</link>
    <description>&lt;P&gt;Many thanks is 9.4 as well.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Jul 2019 07:52:00 GMT</pubDate>
    <dc:creator>jorquec</dc:creator>
    <dc:date>2019-07-09T07:52:00Z</dc:date>
    <item>
      <title>Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571784#M12223</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;Please&amp;nbsp; I don't have any idea how to write a sas code to create a table after a case when validation, as example I would like to create a table just to be a trigger event.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc SQL ( i will get some data from table A which is on teradata)&lt;/P&gt;&lt;P&gt;Create a table STATUSPAYG&lt;/P&gt;&lt;P&gt;If this condition is true:&amp;nbsp; max (A.month_end_dt) = current_date&amp;nbsp;from table A&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;then&amp;nbsp; create a table STATUSPAYG&amp;nbsp; with a simple unique row = 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data STATUSPAYG_final;&lt;BR /&gt;set STATUSPAYG;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My real objective is create a simple table just saying yes or 1 when the condition max(month_end_dt) = current date is true.&lt;/P&gt;&lt;P&gt;Because I will use this table as a trigger event on SAS management console.&lt;/P&gt;&lt;P&gt;Any any help I really appreciate.&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:36:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571784#M12223</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-08T14:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571795#M12224</link>
      <description>&lt;P&gt;What is current date? Do you mean the day at the time that step of the program runs, ie the output of the TODAY() function? Or when the SAS session started? "&amp;amp;sysdate9"d&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also does you variable have a date value or a datetime value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select max_dt = today()
  into :today trimmed
  from (select max(A.month_end_dt) as max_dt from A)
;
quit;

%if &amp;amp;today %then %do;
data STATUSPAYG_final;
  set STATUSPAYG;
run;
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jul 2019 14:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571795#M12224</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-08T14:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571807#M12225</link>
      <description>&lt;P&gt;Sorry , yes current_date is today.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 15:04:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571807#M12225</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-08T15:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571810#M12226</link>
      <description>&lt;P&gt;My variable&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;month_end_dt&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;has just a data value&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 15:06:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571810#M12226</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-08T15:06:43Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571839#M12228</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks for your help!! Just&amp;nbsp; a few questions:&lt;/P&gt;&lt;P&gt;I wrote this code but it returns me some errors msg like:&lt;/P&gt;&lt;P&gt;-ERROR: The %IF statement is not valid in open code.&lt;/P&gt;&lt;P&gt;ERROR: The %END statement is not valid in open code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My SAS version is 7.13&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please tell me if I&amp;nbsp; &amp;nbsp; forgot something.&lt;/P&gt;&lt;P&gt;It created a data set but I don't have a way to see if the table is refreshed so it would be possible to see in the final data set created the max (month_end_dt) found?&amp;nbsp;&lt;/P&gt;&lt;P&gt;the actual code just show me a value 0 (zero)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%include '/SASCommon/jorquec/credentials.sas';&lt;/P&gt;&lt;P&gt;libname jorquec '//SASCommon/jorquec' ; /* criei esse folder para salvar arquivos*/&lt;BR /&gt;libname nuv teradata user= &amp;amp;teradata_user. password = &amp;amp;teradata_pwd. server = 'edwprod' database = 'nuc_pl_user_view';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql noprint ;&lt;BR /&gt;connect to teradata&lt;BR /&gt;(user=&amp;amp;teradata_user. password=&amp;amp;teradata_pwd. server = 'edwprod' database = 'nuc_pl_user_view');&lt;BR /&gt;Create table STATUSPAYG as(&lt;BR /&gt;select max_dt = today()&lt;BR /&gt;into :today trimmed&lt;BR /&gt;from (select max(month_end_dt) as max_dt from nuv.pg_margin_stack)&lt;BR /&gt;)&lt;BR /&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;%if &amp;amp;today %then %do;&lt;BR /&gt;data jorquec.STATUSPAYG_final;&lt;BR /&gt;set STATUSPAYG;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2019 15:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571839#M12228</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-08T15:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571842#M12229</link>
      <description>If you are using an older version of SAS you need to wrap those macro logic statements inside of a macro definition and then run the macro.&lt;BR /&gt;Note: there is no way you are running SAS version 7.13.  There were not 13 releases of SAS version 7 and I doubt you are running a version of SAS that is over 20 years old.&lt;BR /&gt;That must be the version number of the Enterprise Guide program that you are using to submit code to SAS.&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2019 16:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571842#M12229</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-08T16:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571847#M12230</link>
      <description>&lt;P&gt;If you have an old version of SAS and don't want to create a macro then just put the code you want to run into a macro variable instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
%let code=;
select 
'data STATUSPAYG_final;
  set STATUSPAYG;
run;'
  into :code
  from (select max(A.month_end_dt) as max_dt from A)
  where max_dt = today()
;
quit;

&amp;amp;code.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Jul 2019 16:09:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571847#M12230</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-07-08T16:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571849#M12231</link>
      <description>Run the following to find your SAS version:&lt;BR /&gt;&lt;BR /&gt;proc product_status;run; &lt;BR /&gt;&lt;BR /&gt;Results are in the log. Should be something like:&lt;BR /&gt;&lt;BR /&gt;9.4TS1M5&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Jul 2019 16:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571849#M12231</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-07-08T16:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571963#M12252</link>
      <description>&lt;P&gt;Many thanks is 9.4 as well.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 07:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571963#M12252</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-09T07:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Create a data set  after a case when</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571964#M12253</link>
      <description>&lt;P&gt;Many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2019 07:52:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Create-a-data-set-after-a-case-when/m-p/571964#M12253</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-09T07:52:30Z</dc:date>
    </item>
  </channel>
</rss>

