<?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 missing values from a list in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266007#M18456</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;I am trying to create a list where a certain string is deleted from a string list.&lt;/P&gt;
&lt;P&gt;for example: considering the third row in the table below where year=2007M,2011M, the value 2007M,2011M should be deleted from year_list and&amp;nbsp;with end result displayed in variable "want"&amp;nbsp;being "2008,2009,2010". for this same example, the start should be 2007M, as that is the first observation in variable "year".&lt;/P&gt;
&lt;P&gt;THe FINAL table that i want should be as follows:&lt;/P&gt;
&lt;TABLE width="547"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;year&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;year_list&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;want&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M,2007M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2007M,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2008,2009,2010&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I tried arrays to solve this problem, but not able to get anywhere close to the first step.&lt;/P&gt;
&lt;P&gt;I list below my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table have (year VARCHAR(100), year_list VARCHAR(100));
insert into have values('2005M','2005M,2006,2007M,2008,2009,2010,2011M');
insert into have values('2005M,2007M','2005M,2006,2007M,2008,2009,2010,2011M');
insert into have values('2007M,2011M','2005M,2006,2007M,2008,2009,2010,2011M');
run;

data trial (keep=x);
set have(obs=1);
cnt=countw(year_list,",");
i=0;
do while (i&amp;lt;cnt);
i+1;
x=cats("dlv",scan(strip(year_list),i,","));
output;
end;
run;

proc sql ;
select distinct cats("mart",max(countw(year,","))), max(countw(year,",")) into :arraylist,:arraycnt from have;
select distinct cats("dlv",max(countw(year_list,","))), max(countw(year_list,",")) into :dlv_array, :dlvcnt from have;
select distinct x into :array_list separated by ' ' from trial;
run;

data want ;
set have;
length &amp;amp;array_list. $100.;
array dlv(&amp;amp;dlvcnt.) $ &amp;amp;array_list.;
do _j=1 to dim(dlv);
if index(upcase(vname(dlv(_j))),upcase(cats("DLV",dlv[_j]))) then do;
dlv[_j]=scan(year,_j,',');
end;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The array code in the last data step does not display the result i want for the first step of arriving to the final table. The table should look more like:&lt;/P&gt;
&lt;TABLE width="576" style="width: 432pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="9" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD width="64" height="20" style="border: 0px windowtext; border-image: none; width: 48pt; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;year&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;year_list&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2006&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2008&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2009&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2010&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;After getting this table, I look at finding all missing values in the table and listing these out.&lt;/P&gt;
&lt;P&gt;Still left with the dilemma of how to determine the first observation &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any pointers, help, tip would be appreciated.&lt;/P&gt;
&lt;P&gt;thanking you&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2016 11:10:17 GMT</pubDate>
    <dc:creator>sebster24</dc:creator>
    <dc:date>2016-04-25T11:10:17Z</dc:date>
    <item>
      <title>finding missing values from a list</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266007#M18456</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;I am trying to create a list where a certain string is deleted from a string list.&lt;/P&gt;
&lt;P&gt;for example: considering the third row in the table below where year=2007M,2011M, the value 2007M,2011M should be deleted from year_list and&amp;nbsp;with end result displayed in variable "want"&amp;nbsp;being "2008,2009,2010". for this same example, the start should be 2007M, as that is the first observation in variable "year".&lt;/P&gt;
&lt;P&gt;THe FINAL table that i want should be as follows:&lt;/P&gt;
&lt;TABLE width="547"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;year&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;year_list&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;want&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M,2007M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2007M,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2008,2009,2010&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;I tried arrays to solve this problem, but not able to get anywhere close to the first step.&lt;/P&gt;
&lt;P&gt;I list below my code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table have (year VARCHAR(100), year_list VARCHAR(100));
insert into have values('2005M','2005M,2006,2007M,2008,2009,2010,2011M');
insert into have values('2005M,2007M','2005M,2006,2007M,2008,2009,2010,2011M');
insert into have values('2007M,2011M','2005M,2006,2007M,2008,2009,2010,2011M');
run;

data trial (keep=x);
set have(obs=1);
cnt=countw(year_list,",");
i=0;
do while (i&amp;lt;cnt);
i+1;
x=cats("dlv",scan(strip(year_list),i,","));
output;
end;
run;

proc sql ;
select distinct cats("mart",max(countw(year,","))), max(countw(year,",")) into :arraylist,:arraycnt from have;
select distinct cats("dlv",max(countw(year_list,","))), max(countw(year_list,",")) into :dlv_array, :dlvcnt from have;
select distinct x into :array_list separated by ' ' from trial;
run;

data want ;
set have;
length &amp;amp;array_list. $100.;
array dlv(&amp;amp;dlvcnt.) $ &amp;amp;array_list.;
do _j=1 to dim(dlv);
if index(upcase(vname(dlv(_j))),upcase(cats("DLV",dlv[_j]))) then do;
dlv[_j]=scan(year,_j,',');
end;
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The array code in the last data step does not display the result i want for the first step of arriving to the final table. The table should look more like:&lt;/P&gt;
&lt;TABLE width="576" style="width: 432pt; border-collapse: collapse;" border="0" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL width="64" style="width: 48pt;" span="9" /&gt;&lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD width="64" height="20" style="border: 0px windowtext; border-image: none; width: 48pt; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;year&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;year_list&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2006&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2008&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2009&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2010&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="64" style="border: 0px windowtext; border-image: none; width: 48pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;dlv2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15pt;"&gt;
&lt;TD height="20" style="border: 0px windowtext; border-image: none; height: 15pt; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2007M&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD style="border: 0px windowtext; border-image: none; background-color: transparent;"&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;2011M&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;After getting this table, I look at finding all missing values in the table and listing these out.&lt;/P&gt;
&lt;P&gt;Still left with the dilemma of how to determine the first observation &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Any pointers, help, tip would be appreciated.&lt;/P&gt;
&lt;P&gt;thanking you&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 11:10:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266007#M18456</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-04-25T11:10:17Z</dc:date>
    </item>
    <item>
      <title>compare values and note missing values</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/265997#M18457</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;
&lt;P&gt;I am trying to create a list where a certain string is deleted from a string list.&lt;/P&gt;
&lt;P&gt;I adopted the array&amp;nbsp;approach as in the code for the following reasons:&lt;/P&gt;
&lt;P&gt;1) The year and year_list is in character format and comma separated. the year and year_list values are comma separated and sorted.&lt;/P&gt;
&lt;P&gt;2)&amp;nbsp;Variable "want" lists all variables from "year_list2 that are not&amp;nbsp;present in variable "year", however ensuring that the starting point is&amp;nbsp;determined by the first value from variable "year" in "year_list" - as seen in the last row.&lt;/P&gt;
&lt;P&gt;THe table that i want should be as follows:&lt;/P&gt;
&lt;TABLE width="547"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;year&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;year_list&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;want&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2005M,2007M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2006,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="95"&gt;
&lt;P&gt;2007M,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="274"&gt;
&lt;P&gt;2005M,2006,2007M,2008,2009,2010,2011M&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="179"&gt;
&lt;P&gt;2008,2009,2010&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table have (year VARCHAR(100), year_list VARCHAR(100));
insert into have values('2005M','2005M,2006,2007M,2008,2009,2010,20​11M');
insert into have values('2005M,2007M','2005M,2006,2007M,2008,2009,2​010,2011M');
insert into have values('2007M,2011M','2005M,2006,2007M,2008,2009,2​010,2011M');
run;

data tmp1;
set have;
csv=countw(year,",");
codgen_csv=countw(year_list,",");
run;


proc sql ;
select distinct cats("mart",max(csv)), max(csv) into :arraylist,:arraycnt from tmp1;
select distinct cats("dlv",max(codgen_csv)), max(codgen_csv) into :dlv_array, :dlvcnt from tmp1;
run;

data want (drop=list);
set tmp1;
length mart1-&amp;amp;arraylist. $100.;
length dlv1-&amp;amp;dlv_array. $100.;
array mart(&amp;amp;arraycnt.) $;
array dlv(&amp;amp;dlvcnt.) $;
do _i=1 to dim(mart);
mart[_i]=scan(year,_i,',');
end;
do _j=1 to dim(dlv);
dlv[_j]=scan(year_list,_j,',');
end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am really struggling with this. And i don't know how to approach this problem.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any pointers/ help would be appreciated.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 10:17:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/265997#M18457</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-04-25T10:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing values from a list</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266013#M18458</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am sure you have posted this question in the last few weeks, no? &amp;nbsp;Anyways, as always my first question is going to be why? &amp;nbsp;SAS is built around the construct of datasets containing variables which hold One! item per variable. &amp;nbsp;Your trying to fit many data items into one variable, this is just going to cause you headaches through programming. &amp;nbsp;I would suggest the following, normalise your data, have one row per id value. &amp;nbsp;You can then easily apply any programming to that dataset and then if for some reason you need the final, transpose it up again when you have finished - remember the data you program with does not need to look like any out format.&lt;/P&gt;
&lt;P&gt;However, that being said, you can process it as is:&lt;/P&gt;
&lt;PRE&gt;data have;
  length year year_list $200;
  input year $ year_list $;
datalines;
2005M 2005M,2006,2007M,2008,2009,2010,2011M
2005M,2007M 2005M,2006,2007M,2008,2009,2010,2011M
;
run;
data want;
  length want $200;
  set have;
  do i=1 to countw(year_list,",");
    if index(year,scan(year_list,i,","))=0 then want=catx(",",want,scan(year_list,i,","));
  end;
run;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Apr 2016 11:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266013#M18458</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-04-25T11:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing values from a list</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266019#M18459</link>
      <description>&lt;P&gt;Sorry for the pestering and double emails. I am not pleased with the format structure that i presented in the post.THis is data that i receive from third party and a request to deliver in a better format is something they cannot do &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Sir RW9, you are a genius.&lt;/P&gt;
&lt;P&gt;&lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://communities.sas.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For anyone having a similar query, slightly modified solution below: to produce desired outcome&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data want (drop=i);
	length want $200;
	set have;
	do i=1 to countw(year_list,",");
		if index(year,scan(substr(year_list,max(index(year_list,scan(year,1,",")),1)),i,","))=0 then
			want=catx(",",want,scan(substr(year_list,max(index(year_list,scan(year,1,",")),1)),i,","));
	end;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2016 12:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266019#M18459</guid>
      <dc:creator>sebster24</dc:creator>
      <dc:date>2016-04-25T12:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: finding missing values from a list</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266270#M18472</link>
      <description>I am not sure I understand what is your mean completely .

&lt;PRE&gt;

data have;
infile cards dlm=' ';
input year :$20. year_list : $100. ;
cards;
2005M 2005M,2006,2007M,2008,2009,2010,2011M
2005M,2007M 2005M,2006,2007M,2008,2009,2010,2011M
2007M,2011M 2005M,2006,2007M,2008,2009,2010,2011M
;
run;
data want;
 set have;
 length want $ 200;
 first=scan(year,1,',');
 s=findw(year_list,strip(first));
 temp=substr(year_list,s);
 do i=1 to countw(temp,',');
  t=scan(temp,i,',');
  if not findw(year,strip(t)) then want=catx(',',want,t);
 end;
 drop t i s temp first ;
run;

&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 03:09:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/finding-missing-values-from-a-list/m-p/266270#M18472</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-04-26T03:09:50Z</dc:date>
    </item>
  </channel>
</rss>

