<?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: Search and retrieve data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424820#M104591</link>
    <description>&lt;P&gt;Notes:&lt;/P&gt;&lt;P&gt;1. 100s of variables with the same pattern with a numeric suffix is easy to list as array elements using variable lists like var1-var100 and so on. I trust you can do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. either using variable lists is the best short cut method to specify and compile with the array statement&lt;/P&gt;&lt;P&gt;3. if all vars after the conditional test happens to be missing , would have to be equal to total number of elements in the array to delete the observation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Jan 2018 05:27:16 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-01-04T05:27:16Z</dc:date>
    <item>
      <title>Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424818#M104589</link>
      <description>&lt;P&gt;Hi There,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need help to search a character and retrieve the data that match the character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input ID $ data1 $ data2 $ data3 $ data4 $;&lt;BR /&gt;datalines;&lt;BR /&gt;1 ?_B C_D A_C B_D &lt;BR /&gt;2 A_A D_? A_A ?_B &lt;BR /&gt;3 B_B C_C C_C D_D &lt;BR /&gt;4 R_T P_? C_? K_A &lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to output data that have "?" in it. I have more than 100 variables to search for.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want the output like this:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl64" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="border-left: none; width: 48pt;"&gt;data1&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="border-left: none; width: 48pt;"&gt;data2&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="border-left: none; width: 48pt;"&gt;data3&lt;/TD&gt;
&lt;TD width="64" class="xl63" style="border-left: none; width: 48pt;"&gt;data4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;D_?&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl64" style="height: 15.0pt; border-top: none;"&gt;4&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;P_?&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;C_?&lt;/TD&gt;
&lt;TD class="xl63" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424818#M104589</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T05:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424819#M104590</link>
      <description>&lt;P&gt;here you go-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;input ID $ data1 $ data2 $ data3 $ data4 $;&lt;BR /&gt;datalines;&lt;BR /&gt;1 ?_B C_D A_C B_D&lt;BR /&gt;2 A_A D_? A_A ?_B&lt;BR /&gt;3 B_B C_C C_C D_D&lt;BR /&gt;4 R_T P_? C_? K_A&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;array t(*) data1-data4;&lt;BR /&gt;do _n_=1 to dim(t);&lt;BR /&gt;if index(t(_n_),'?')&amp;gt;0 then continue;&lt;BR /&gt;else call missing(t(_n_));&lt;BR /&gt;end;&lt;BR /&gt;if cmiss(of t(*))=dim(t) then delete;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424819#M104590</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T05:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424820#M104591</link>
      <description>&lt;P&gt;Notes:&lt;/P&gt;&lt;P&gt;1. 100s of variables with the same pattern with a numeric suffix is easy to list as array elements using variable lists like var1-var100 and so on. I trust you can do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. either using variable lists is the best short cut method to specify and compile with the array statement&lt;/P&gt;&lt;P&gt;3. if all vars after the conditional test happens to be missing , would have to be equal to total number of elements in the array to delete the observation&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424820#M104591</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T05:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424821#M104592</link>
      <description>&lt;P&gt;thanks for the speedy response!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it's almost there.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;as you see that ID 3 does not have any "?" in all variables, so I do not need to retrieve ID 3.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;again this is what I want:&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 240pt;" border="0" width="320" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl66" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data3&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D_?&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;P_?&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;C_?&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:27:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424821#M104592</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T05:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424822#M104593</link>
      <description>&lt;P&gt;yes i have edited the code to delete the 3rd obs later. sorry. Please notice the edit. Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please notice this addition in the edit:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if cmiss(of t(*))=dim(t) then delete;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:29:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424822#M104593</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T05:29:38Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424823#M104594</link>
      <description>&lt;P&gt;Very good!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just realize that not all the variables have "?" data, I would like not to retrieve the variables that have no "?".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;input ID $ data1 $ data2 $ data3 $ data4 $;&lt;BR /&gt;datalines;&lt;BR /&gt;1 ?_B C_D A_C B_D&lt;BR /&gt;2 A_A D_? A_A ?_B&lt;BR /&gt;3 B_B C_C C_C D_D&lt;BR /&gt;4 R_T P_? C_J K_A&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the output should look like this:&amp;nbsp; -- no data3&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 192pt;" border="0" width="256" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" class="xl66" style="height: 15.0pt; width: 48pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data1&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data2&lt;/TD&gt;
&lt;TD width="64" class="xl65" style="border-left: none; width: 48pt;"&gt;data4&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;1&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;2&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;D_?&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;?_B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" class="xl66" style="height: 15.0pt; border-top: none;"&gt;4&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;P_?&lt;/TD&gt;
&lt;TD class="xl65" style="border-top: none; border-left: none;"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:36:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424823#M104594</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T05:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424824#M104595</link>
      <description>&lt;P&gt;Do you mean, you want to drop the column from the result if all values of a column is blank?&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:40:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424824#M104595</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T05:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424825#M104596</link>
      <description>&lt;P&gt;yes, please .&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:41:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424825#M104596</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T05:41:47Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424828#M104598</link>
      <description>&lt;P&gt;Read through this document&amp;nbsp;&lt;A href="https://www.lexjansen.com/nesug/nesug13/90_Final_Paper.pdf" target="_blank"&gt;https://www.lexjansen.com/nesug/nesug13/90_Final_Paper.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;while i try something simpler meanwhile&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:49:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424828#M104598</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T05:49:06Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424832#M104599</link>
      <description>&lt;P&gt;Thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 05:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424832#M104599</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T05:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424834#M104600</link>
      <description>&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; have;&lt;/P&gt;&lt;P&gt;input ID $ data1 $ data2 $ data3 $ data4 $;&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 ?_B C_D A_C B_D&lt;/P&gt;&lt;P&gt;2 A_A D_? A_A ?_B&lt;/P&gt;&lt;P&gt;3 B_B C_C C_C D_D&lt;/P&gt;&lt;P&gt;4 R_T P_? C_J K_A&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; &lt;STRONG&gt;&lt;EM&gt;op_ursula&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;data want1;&lt;/P&gt;&lt;P&gt;set have nobs=nobs end=last;&lt;/P&gt;&lt;P&gt;array t(*) data1-data4;&lt;/P&gt;&lt;P&gt;array t1(*) _data1-_data4;&lt;/P&gt;&lt;P&gt;do _n_=&lt;STRONG&gt;1&lt;/STRONG&gt; to dim(t);&lt;/P&gt;&lt;P&gt;if index(t(_n_),'?')&amp;gt;&lt;STRONG&gt;0&lt;/STRONG&gt; then continue;&lt;/P&gt;&lt;P&gt;else call missing(t(_n_));&lt;/P&gt;&lt;P&gt;if missing(t(_n_)) then t1(_n_)+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;if last then do;&lt;/P&gt;&lt;P&gt;if t1(_n_)=nobs then do;&lt;/P&gt;&lt;P&gt;call symputX('POS'||left(_n_),vname(t(_n_)));&lt;/P&gt;&lt;P&gt;_c=_n_;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;call symputX('count',_c);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data final_want;&lt;/P&gt;&lt;P&gt;set want1;&lt;/P&gt;&lt;P&gt;drop&amp;nbsp; %do i=&lt;STRONG&gt;1&lt;/STRONG&gt; %to &amp;amp;count;&lt;/P&gt;&lt;P&gt;%if %symexist(pos&amp;amp;i) %then&amp;nbsp; &amp;amp;&amp;amp;pos&amp;amp;count;&lt;/P&gt;&lt;P&gt;%end; _: ;&lt;/P&gt;&lt;P&gt;array t(*) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data1-data4;&lt;/P&gt;&lt;P&gt;if cmiss(of t(*))=dim(t) then delete;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;op_ursula&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 06:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424834#M104600</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T06:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424842#M104603</link>
      <description>&lt;P&gt;thank you so much for your help.&lt;/P&gt;
&lt;P&gt;I wonder why it does not work on my real data,&amp;nbsp;still retrieve all columns even though there are no "?" mark in them.&lt;/P&gt;
&lt;P&gt;I do not really understand the codes, but it works on the sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would look into it later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you again.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 07:00:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424842#M104603</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T07:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424843#M104604</link>
      <description>&lt;P&gt;Go through the code statement by statement thoroughly until you understand. I am gonna sleep now. If you need any help on this thread, I'll look into your requirement&amp;nbsp;when i wake&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 07:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424843#M104604</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-01-04T07:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424863#M104611</link>
      <description>&lt;P&gt;This is a common problem, and one caused by the "Excel way of thinking" which seems to permeate throughout SAS programming nowadays.&amp;nbsp; You have X numbers of fixed columns, and Y number of non-fixed columns, and are now trying to find a way to process them logically.&amp;nbsp; A simple mindset change to work "In the programmers way of thinking" makes this kind of issue go away.&amp;nbsp; There are two main data structures, transposed - which is what you have and is useful for reporting out for humans to read, and normalised - which is useful for storage, programming etc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So from a storage point of view you have 12 cells to contain 5 data items, which is a waste.&amp;nbsp; From a programming point of view you have to work out how many elements, scan through each, and of course do this each time you want to use it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A far simpler storage would be:&lt;/P&gt;
&lt;PRE&gt;data have;
  input ID $ data1 $ data2 $ data3 $ data4 $;
datalines;
1 ?_B C_D A_C B_D 
2 A_A D_? A_A ?_B 
3 B_B C_C C_C D_D 
4 R_T P_? C_? K_A 
;
run;

proc transpose data=have out=want;
  by id;
  var data:;
run;

data want;
  set want;
  where index(col1,"?")&amp;gt;0;
run;&lt;/PRE&gt;
&lt;P&gt;So normalise the data, then its simply a matter of where clauses and such like to access the data you want.&amp;nbsp; Compare that to all the array codes and such like given before, how much simpler?&lt;/P&gt;
&lt;P&gt;And if you need the transposed results at the end for a report, use another proc transpose to go up again.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 09:17:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/424863#M104611</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-01-04T09:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/425009#M104671</link>
      <description>&lt;P&gt;Thanks so much for the simpler codes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes, it works!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2018 18:02:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/425009#M104671</guid>
      <dc:creator>ursula</dc:creator>
      <dc:date>2018-01-04T18:02:50Z</dc:date>
    </item>
    <item>
      <title>Re: Search and retrieve data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/425135#M104709</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/34666"&gt;@ursula&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If it works then please mark the question as answered.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2018 04:24:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-and-retrieve-data/m-p/425135#M104709</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-01-05T04:24:26Z</dc:date>
    </item>
  </channel>
</rss>

