<?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 Finding if the Accounts are available in the datasets in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911560#M40792</link>
    <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I have a datasets which has a lot of information. I have imported an excel file (Nov_BF) which has just 43 account numbers (Account_ID). I want to see if these 43 account number are available in the Finrep_sorted dataset or not. I would also like to add all the variables from Finrep_sorted for these 43 accounts from Nov_BF. Here is the sample dataset:&lt;/P&gt;
&lt;P&gt;Data Finrep_sorted;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input ACCOUNT_ID FINREP_CURR_SEGMENT$ FINREP_CURR_SEGMENT_REASON$ SOURCE_SYSTEM_CD$ MONTH;&lt;BR /&gt;datalines ;&lt;BR /&gt;1000032 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000040 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000278 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000307 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;5464782 PERFORMINGFORBORNE PROBATIONNOTENDED AF 202311&lt;BR /&gt;5320998 NON-PERFORMING CONTAGION AF 202311&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;I want the output data to show all the matching accounts and all the variables from Finrep_sorted. I tried merging them and then find but my code gives an error. Please guide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data merged_data;
Merge Nov_BF (In=InNov_BF)
Finrep_sorted (In=InFinrep_sorted);
by ACCOUNT_ID;
If InFinrep_sorted; /* Filter to include only matching account numbers */
run;
Error message:
28         Data merged_data;
29         Merge Nov_BF (In=InNov_BF)
30         Finrep_sorted (In=InFinrep_sorted);
31         by ACCOUNT_ID;
32         If InFinrep_sorted; /* Filter to include only matching account numbers */
33         run;

ERROR: BY variable ACCOUNT_ID is not on input data set WORK.NOV_BF.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MERGED_DATA may be incomplete.  When this step was stopped there were 0 observations and 6 variables.
WARNING: Data set WORK.MERGED_DATA was not replaced because this step was stopped.&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 15 Jan 2024 11:31:55 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2024-01-15T11:31:55Z</dc:date>
    <item>
      <title>Finding if the Accounts are available in the datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911560#M40792</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I have a datasets which has a lot of information. I have imported an excel file (Nov_BF) which has just 43 account numbers (Account_ID). I want to see if these 43 account number are available in the Finrep_sorted dataset or not. I would also like to add all the variables from Finrep_sorted for these 43 accounts from Nov_BF. Here is the sample dataset:&lt;/P&gt;
&lt;P&gt;Data Finrep_sorted;&lt;BR /&gt;infile cards expandtabs;&lt;BR /&gt;input ACCOUNT_ID FINREP_CURR_SEGMENT$ FINREP_CURR_SEGMENT_REASON$ SOURCE_SYSTEM_CD$ MONTH;&lt;BR /&gt;datalines ;&lt;BR /&gt;1000032 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000040 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000278 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;1000307 PERFORMING MEETREQUIREMENTS AF 202311&lt;BR /&gt;5464782 PERFORMINGFORBORNE PROBATIONNOTENDED AF 202311&lt;BR /&gt;5320998 NON-PERFORMING CONTAGION AF 202311&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;I want the output data to show all the matching accounts and all the variables from Finrep_sorted. I tried merging them and then find but my code gives an error. Please guide.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data merged_data;
Merge Nov_BF (In=InNov_BF)
Finrep_sorted (In=InFinrep_sorted);
by ACCOUNT_ID;
If InFinrep_sorted; /* Filter to include only matching account numbers */
run;
Error message:
28         Data merged_data;
29         Merge Nov_BF (In=InNov_BF)
30         Finrep_sorted (In=InFinrep_sorted);
31         by ACCOUNT_ID;
32         If InFinrep_sorted; /* Filter to include only matching account numbers */
33         run;

ERROR: BY variable ACCOUNT_ID is not on input data set WORK.NOV_BF.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.MERGED_DATA may be incomplete.  When this step was stopped there were 0 observations and 6 variables.
WARNING: Data set WORK.MERGED_DATA was not replaced because this step was stopped.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Jan 2024 11:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911560#M40792</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2024-01-15T11:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Finding if the Accounts are available in the datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911561#M40793</link>
      <description>&lt;P&gt;You get this error, which seems to be very self-explanatory.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#FF0000"&gt;ERROR: BY variable ACCOUNT_ID is not on input data set WORK.NOV_BF.&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;You can't merge by a variable that doesn't exist in one (or both) of the data sets.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 11:46:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911561#M40793</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-15T11:46:57Z</dc:date>
    </item>
    <item>
      <title>Re: Finding if the Accounts are available in the datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911562#M40794</link>
      <description>&lt;P&gt;But the excel file that I imported (Nov_BF) does have Account_ID and from the sample dataset you can see that there is Account_ID in the Finrep_sorted as well. Then why it is showing that there is no account_id?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 11:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911562#M40794</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2024-01-15T11:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Finding if the Accounts are available in the datasets</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911563#M40795</link>
      <description>&lt;P&gt;My rule: when SAS says something is true and the user says something is not true, then I believe SAS. Show us PROC CONTENTS output on the SAS data set WORK.NOV_BF. It also does NOT matter what was in Excel; what matters is what is in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(In fact, whenever you find yourself in this situation where it appears you don't have a specific variable in that data set, you need to check the PROC CONTENTS output for that data set)&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jan 2024 11:52:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Finding-if-the-Accounts-are-available-in-the-datasets/m-p/911563#M40795</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-01-15T11:52:02Z</dc:date>
    </item>
  </channel>
</rss>

