<?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 new dataset for conditional basis in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180186#M34443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for looking into the matter.&lt;/P&gt;&lt;P&gt;Out of the two datasets (master and child), the condition is that child dataset can only be created in work library if and only if number of records in master table &amp;gt;=3&lt;/P&gt;&lt;P&gt;e.g. in the above example , As the master dataset contain only 3 record which means it satisfy the condition.&lt;/P&gt;&lt;P&gt;Therefore the child dataset should be created. How to write.&lt;/P&gt;&lt;P&gt;something like below&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;input pid age gender;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 23 1&lt;/P&gt;&lt;P&gt;102 34 5&lt;/P&gt;&lt;P&gt;103 54 6 ;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table cnt_master as select count(*) as cnt from master; quit;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;set cnt_master;&lt;/P&gt;&lt;P&gt;if cnt&amp;gt;=3 then output child&lt;/P&gt;&lt;P&gt;( data child;&lt;/P&gt;&lt;P&gt;input empid ename $ job $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1001 John clerk&lt;/P&gt;&lt;P&gt;1002 Esten Analyst&lt;/P&gt;&lt;P&gt;1003 Ruakin principal&lt;/P&gt;&lt;P&gt;; )&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Jul 2014 04:26:54 GMT</pubDate>
    <dc:creator>Abraham</dc:creator>
    <dc:date>2014-07-16T04:26:54Z</dc:date>
    <item>
      <title>create new dataset for conditional basis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180184#M34441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Everyone! I have two dataset "master" and "child" in my program.&lt;/P&gt;&lt;P&gt;&lt;STRONG style="text-decoration: underline;"&gt;Condition&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;The child table will only be created if the count of number of record for master table &amp;gt;=3.&lt;/P&gt;&lt;P&gt;I wrote the prog below but don't know how to connect both dataset. Sorry this might be the foolish question as I did not find the solution. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data child;&lt;/P&gt;&lt;P&gt;input empid ename $ job $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1001 John clerk&lt;/P&gt;&lt;P&gt;1002 Esten Analyst&lt;/P&gt;&lt;P&gt;1003 Ruakin principal&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;input pid age gender;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 23 1&lt;/P&gt;&lt;P&gt;102 34 5&lt;/P&gt;&lt;P&gt;103 54 6&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table cnt_master&lt;/P&gt;&lt;P&gt;as select count(*) as cnt from master;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;set cnt_master;&lt;/P&gt;&lt;P&gt;if cnt&amp;gt;=3 then output child;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2014 17:30:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180184#M34441</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2014-07-15T17:30:44Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset for conditional basis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180185#M34442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure what you mean when you say connect. It would also help to provide an exampe of what you want for the final output.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Jul 2014 17:44:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180185#M34442</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-07-15T17:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset for conditional basis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180186#M34443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for looking into the matter.&lt;/P&gt;&lt;P&gt;Out of the two datasets (master and child), the condition is that child dataset can only be created in work library if and only if number of records in master table &amp;gt;=3&lt;/P&gt;&lt;P&gt;e.g. in the above example , As the master dataset contain only 3 record which means it satisfy the condition.&lt;/P&gt;&lt;P&gt;Therefore the child dataset should be created. How to write.&lt;/P&gt;&lt;P&gt;something like below&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;input pid age gender;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;101 23 1&lt;/P&gt;&lt;P&gt;102 34 5&lt;/P&gt;&lt;P&gt;103 54 6 ;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table cnt_master as select count(*) as cnt from master; quit;&lt;/P&gt;&lt;P&gt;data final;&lt;/P&gt;&lt;P&gt;set cnt_master;&lt;/P&gt;&lt;P&gt;if cnt&amp;gt;=3 then output child&lt;/P&gt;&lt;P&gt;( data child;&lt;/P&gt;&lt;P&gt;input empid ename $ job $;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1001 John clerk&lt;/P&gt;&lt;P&gt;1002 Esten Analyst&lt;/P&gt;&lt;P&gt;1003 Ruakin principal&lt;/P&gt;&lt;P&gt;; )&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 04:26:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180186#M34443</guid>
      <dc:creator>Abraham</dc:creator>
      <dc:date>2014-07-16T04:26:54Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset for conditional basis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180187#M34444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is this what you are after?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPTIONS MPRINT MLOGIC SYMBOLGEN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA MASTER;&lt;/P&gt;&lt;P&gt;INFILE "E:\MASTER.TXT";&lt;/P&gt;&lt;P&gt;INPUT PID AGE GENDER;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC SQL NOPRINT;&lt;/P&gt;&lt;P&gt;SELECT COUNT(*) INTO: MASTCNT FROM MASTER;&lt;/P&gt;&lt;P&gt;QUIT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO IMPORT;&lt;/P&gt;&lt;P&gt;%IF &amp;amp;MASTCNT. &amp;gt;= 3 %THEN %DO;&lt;/P&gt;&lt;P&gt;DATA CHILD;&lt;/P&gt;&lt;P&gt;INFILE "E:\CHILD.TXT";&lt;/P&gt;&lt;P&gt;INPUT EMPID ENAME $ JOB $;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%MEND;&lt;/P&gt;&lt;P&gt;%IMPORT;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 05:02:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180187#M34444</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2014-07-16T05:02:20Z</dc:date>
    </item>
    <item>
      <title>Re: create new dataset for conditional basis</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180188#M34445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or, to save the macro part:&lt;/P&gt;&lt;P&gt;OPTIONS MPRINT MLOGIC SYMBOLGEN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA MASTER;&lt;/P&gt;&lt;P&gt;INFILE "E:\MASTER.TXT";&lt;/P&gt;&lt;P&gt;INPUT PID AGE GENDER;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.vtable (where=(libname="WORK" and memname="MASTER" and NOBS &amp;gt; 3));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute('data child;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "e:\child.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input empid ename $ job $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Jul 2014 09:04:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-dataset-for-conditional-basis/m-p/180188#M34445</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-16T09:04:27Z</dc:date>
    </item>
  </channel>
</rss>

