<?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: Read one dataset and check for variable in other dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596521#M171762</link>
    <description>&lt;P&gt;That sounds like a complex operation. But I am a little confused about want you are trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently it sounds like you already have a list of errors and want to confirm that they are errors. So you want scan a list of error codes.&amp;nbsp; And then for certain error codes perform some separate process that tests whether that error code was properly raised.&amp;nbsp; Sort of quality control process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you mean that you have a control file that describes what tests you want perform.&amp;nbsp; So there is record in the metadata/control file that says check if variable X in dataset Y has any (all?) missing values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For either of these I would traditionally use the control/metadata/error dataset to drive the creation of the code that needs to run.&amp;nbsp; Then run the code and collect the results.&amp;nbsp; Now with the introduction of DOSUBL() function might be able to run steps in a separate execution space while your current data step pauses so you could control the whole flow with a single data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case it might make sense to create macros that generate the code for the tests based on input parameters. Then the code generation in either case is just a matter of passing the values to the parameters in the macro call.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Oct 2019 13:44:52 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-10-15T13:44:52Z</dc:date>
    <item>
      <title>Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596500#M171748</link>
      <description>&lt;P&gt;In the following code I want to&amp;nbsp;conditionally create the variables based on the validation which was in the code below. In case if the 'Insurance_ID' variable is missing in the dataset where we read through SET Statement then I want to open the other dataset (insurance_source)&amp;nbsp;and see whether that variable is missing. If it is still missing then my Validation is right else I want a note in the log file as stated in the comment portion /**/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Because Insurance_ID is first created in insurance_source dataset as a Primary key and this variable is available in other dataset 'insurance_data' which is being coming from insurance_source dataset. so if the Insurance_ID is missing in the bothe the datasets then my validation is right and if it is missing in one of the dataset 'insurance_data' then it means something has went wrong while creating this dataset which i need to investigate and therefore I need a note in the log file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data error_data;
length FLT_ID 8	ERR_MSG $100 FLT_REC $200;
keep FLT_ID ERR_MSG FLT_REC;
set insurance_data;
FLT_REC=cats(SOURCE_CD,'|',FILE_ID,'|',Delivery_ID)
FLT_ID=44;
ERR_MSG_TXT="Insurance ID cannot be missing";
if missing(Insurance_ID) then
/*look at the other dataset insurance_source and check for Insurance_ID is missing and if still missing then our validation is right else write a note in the log stating inspect the source dataset*/
output;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596500#M171748</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-15T12:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596505#M171750</link>
      <description>&lt;P&gt;What do you mean by "missing"?&lt;/P&gt;
&lt;P&gt;The variable is not there in the dataset, or it contains missing values?&lt;/P&gt;
&lt;P&gt;If it is the latter, on which condition do you join the two datasets to look for a non-missing value?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 12:48:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596505#M171750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-15T12:48:47Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596510#M171753</link>
      <description>Missing means missing values.&lt;BR /&gt;&lt;BR /&gt;I'm not certain about join condition. Both the tables are part of ETL.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:08:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596510#M171753</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-15T13:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596514#M171755</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/292396"&gt;@David_Billa&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Missing means missing values.&lt;BR /&gt;&lt;BR /&gt;I'm not certain about join condition. Both the tables are part of ETL.&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Well, you need to know which observation from the second dataset you should select to replace a missing insurance_id in the first, or you'll get unpredictable results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To further clarify, you should post example data for both datasets (in usable form, as shown in &lt;A href="https://communities.sas.com/t5/SAS-Programming/Data-validation-and-writing-the-error-record-in-a-variable/m-p/596304/highlight/true#M171674" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Programming/Data-validation-and-writing-the-error-record-in-a-variable/m-p/596304/highlight/true#M171674&lt;/A&gt;), and what you expect as result.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596514#M171755</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-15T13:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596516#M171757</link>
      <description>It's OK if I get the unpredicted results. Atleast I know the way to develop&lt;BR /&gt;further.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596516#M171757</guid>
      <dc:creator>David_Billa</dc:creator>
      <dc:date>2019-10-15T13:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596519#M171760</link>
      <description>&lt;P&gt;What if you have 5 missing values in the first dataset, but only 3 values in the second? Please supply example data and expected output.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596519#M171760</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-15T13:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596521#M171762</link>
      <description>&lt;P&gt;That sounds like a complex operation. But I am a little confused about want you are trying to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently it sounds like you already have a list of errors and want to confirm that they are errors. So you want scan a list of error codes.&amp;nbsp; And then for certain error codes perform some separate process that tests whether that error code was properly raised.&amp;nbsp; Sort of quality control process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you mean that you have a control file that describes what tests you want perform.&amp;nbsp; So there is record in the metadata/control file that says check if variable X in dataset Y has any (all?) missing values.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For either of these I would traditionally use the control/metadata/error dataset to drive the creation of the code that needs to run.&amp;nbsp; Then run the code and collect the results.&amp;nbsp; Now with the introduction of DOSUBL() function might be able to run steps in a separate execution space while your current data step pauses so you could control the whole flow with a single data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case it might make sense to create macros that generate the code for the tests based on input parameters. Then the code generation in either case is just a matter of passing the values to the parameters in the macro call.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 13:44:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596521#M171762</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-15T13:44:52Z</dc:date>
    </item>
    <item>
      <title>Re: Read one dataset and check for variable in other dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596549#M171776</link>
      <description>&lt;P&gt;I can think of several ways to go about this, some interesting, some boring.&amp;nbsp; But all of them depend on what is in your INSURANCE_SOURCE data set.&amp;nbsp; I know it's clear as day to you, but it's clear as mud to us.&amp;nbsp; Either list a few observations, or describe what is in it.&amp;nbsp; The programming can't begin until we understand what is in the data.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2019 14:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-one-dataset-and-check-for-variable-in-other-dataset/m-p/596549#M171776</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-10-15T14:53:11Z</dc:date>
    </item>
  </channel>
</rss>

