<?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 Populating IDs from external file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Populating-IDs-from-external-file/m-p/439291#M109608</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have some stored IDs that I need to assign to my observations. At the end I also want to disappear those IDs from that ID table and update that table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Have;
INPUT Course_ID$ age State$;
DATALINES;
ENG1 15 NY
Che1 10 NY
Eng2 15 CA
Phy2 11 PA
Che1 15 TX
;
RUN;

DATA ids;
INPUT slno;
DATALINES;
107
101
105
116
264
552
145
235
224
117
100
;
RUN;

PROC SORT DATA=ids;
BY slno;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At the end I want the table 'Have' to be populated with slno from 'ids' table and lname it as want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Want&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;slno&amp;nbsp; &amp;nbsp;course_ID&amp;nbsp; Age State&lt;/P&gt;
&lt;P&gt;100&amp;nbsp; &amp;nbsp;ENG1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; &amp;nbsp;NY&lt;BR /&gt;101&amp;nbsp; &amp;nbsp;Che1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&amp;nbsp; &amp;nbsp; NY&lt;BR /&gt;105&amp;nbsp; &amp;nbsp;Eng2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; CA&lt;BR /&gt;107&amp;nbsp; &amp;nbsp;Phy2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&amp;nbsp; &amp;nbsp; PA&lt;BR /&gt;116&amp;nbsp; &amp;nbsp;Che1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; TX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, at the end ids table should stay with the remaining slno&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ids&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;slno&lt;/P&gt;
&lt;P&gt;117&lt;/P&gt;
&lt;P&gt;145&lt;/P&gt;
&lt;P&gt;224&lt;/P&gt;
&lt;P&gt;235&lt;/P&gt;
&lt;P&gt;264&lt;/P&gt;
&lt;P&gt;552&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help in advance&lt;/P&gt;</description>
    <pubDate>Thu, 22 Feb 2018 14:37:32 GMT</pubDate>
    <dc:creator>mlogan</dc:creator>
    <dc:date>2018-02-22T14:37:32Z</dc:date>
    <item>
      <title>Populating IDs from external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Populating-IDs-from-external-file/m-p/439291#M109608</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I have some stored IDs that I need to assign to my observations. At the end I also want to disappear those IDs from that ID table and update that table.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA Have;
INPUT Course_ID$ age State$;
DATALINES;
ENG1 15 NY
Che1 10 NY
Eng2 15 CA
Phy2 11 PA
Che1 15 TX
;
RUN;

DATA ids;
INPUT slno;
DATALINES;
107
101
105
116
264
552
145
235
224
117
100
;
RUN;

PROC SORT DATA=ids;
BY slno;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;At the end I want the table 'Have' to be populated with slno from 'ids' table and lname it as want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Want&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;slno&amp;nbsp; &amp;nbsp;course_ID&amp;nbsp; Age State&lt;/P&gt;
&lt;P&gt;100&amp;nbsp; &amp;nbsp;ENG1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; &amp;nbsp;NY&lt;BR /&gt;101&amp;nbsp; &amp;nbsp;Che1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&amp;nbsp; &amp;nbsp; NY&lt;BR /&gt;105&amp;nbsp; &amp;nbsp;Eng2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; CA&lt;BR /&gt;107&amp;nbsp; &amp;nbsp;Phy2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&amp;nbsp; &amp;nbsp; PA&lt;BR /&gt;116&amp;nbsp; &amp;nbsp;Che1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;15&amp;nbsp; &amp;nbsp; TX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, at the end ids table should stay with the remaining slno&lt;STRONG&gt;:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;ids&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;slno&lt;/P&gt;
&lt;P&gt;117&lt;/P&gt;
&lt;P&gt;145&lt;/P&gt;
&lt;P&gt;224&lt;/P&gt;
&lt;P&gt;235&lt;/P&gt;
&lt;P&gt;264&lt;/P&gt;
&lt;P&gt;552&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your help in advance&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Populating-IDs-from-external-file/m-p/439291#M109608</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2018-02-22T14:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Populating IDs from external file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Populating-IDs-from-external-file/m-p/439296#M109611</link>
      <description>&lt;P&gt;Here's some code that I think will get what you're looking for!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA have ids(KEEP=slno);
	MERGE ids (IN=a)
	      have (IN=b);
	IF a AND b THEN output have;
	IF a AND not b THEN output ids;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've told the IDs to mash up horizontally with the data in have and&amp;nbsp;only print to the have data set if there was a match. For cases where there was an ID but nothing to match it to, it was added back to ids and only the slno variable was preserved;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2018 14:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Populating-IDs-from-external-file/m-p/439296#M109611</guid>
      <dc:creator>GinaRepole</dc:creator>
      <dc:date>2018-02-22T14:43:46Z</dc:date>
    </item>
  </channel>
</rss>

