<?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: How to drop a variable  when criteria is met in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632060#M187346</link>
    <description>&lt;P&gt;Third idea:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Id. date.     Journal Duration&lt;BR /&gt;A1. 03/01/20. ABCD.   1
A2. 03/01/20. BCDA.   4&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Take what you have but save and concatenate &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;STRONG style="font-style: normal; font-weight: bold;"&gt;Col:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; variables into long strings.&amp;nbsp; We over here, call strings names like this "Journey" or "Journal" because they usually are chronologically ordered for us.&amp;nbsp; Using appropriate logic, change the Journal strings with F&lt;FONT size="3"&gt;ind&lt;/FONT&gt;(), &lt;FONT size="3"&gt;Scan&lt;/FONT&gt;(), &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;SubStr&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;(), &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;TranWRD&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;(), etc. to arrive at what you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I employ &lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;regular expressions (i.e. PRXmatch() etc.)&amp;nbsp; to make matches in this context, because it eliminates a lot of if-then structures, but maybe your logic is simple enough to avoid regexp.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Mar 2020 20:19:18 GMT</pubDate>
    <dc:creator>PhilC</dc:creator>
    <dc:date>2020-03-13T20:19:18Z</dc:date>
    <item>
      <title>How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632007#M187326</link>
      <description>Hi I have a table  52 columns  I need to remove some of the variable that matches criteria .here is example of table &lt;BR /&gt;Id. date.              Col   Col1.  Col2  Cola3  Duration &lt;BR /&gt;A1. 03/01/20.     A.     B.         C.       D.            1&lt;BR /&gt;A2. 03/01/20.    B.       C.        D.         A.             4&lt;BR /&gt;&lt;BR /&gt;What I want to see &lt;BR /&gt;Id. date.              Col   Col1.  Col2  Cola3  Duration &lt;BR /&gt;A1. 03/01/20.     A.     B.         C.       D.            1&lt;BR /&gt;A2. 03/01/20.             C.        D.         A.             4&lt;BR /&gt;I used alter &lt;BR /&gt;But drops the whole col just need it to drop a section of the row &lt;BR /&gt;</description>
      <pubDate>Fri, 13 Mar 2020 18:07:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632007#M187326</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2020-03-13T18:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632009#M187328</link>
      <description>&lt;P&gt;You cannot conditionally drop a variable from one row, you can only set it to missing.&lt;/P&gt;
&lt;P&gt;Or, in an array of variables of equal type, move all values to the left, so that the last one is missing.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 18:11:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632009#M187328</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-13T18:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632015#M187331</link>
      <description>Would you be able to show me how to move everything in one row where duration is greater then 3 min ?</description>
      <pubDate>Fri, 13 Mar 2020 18:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632015#M187331</guid>
      <dc:creator>BETO</dc:creator>
      <dc:date>2020-03-13T18:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632021#M187334</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19504"&gt;@BETO&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Would you be able to show me how to move everything in one row where duration is greater then 3 min ?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can you show example data of what the starting values are and what the desired result would be? Best is to provide the data in the form of a data step so we don't have to guess about variable types or names. And what you ask may not make sense if the variables are mixed numeric and character.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 18:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632021#M187334</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-13T18:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632054#M187341</link>
      <description>&lt;P&gt;Drop is the wrong concept, I think.&amp;nbsp; Maybe transposed data would help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;ssuming ID and date are necessary to separate cases.&amp;nbsp; You can s&lt;/SPAN&gt;tart with what you have, then using PROC TRANSPOSE to create data like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;A1. 03/01/20. A. 
A1. 03/01/20. B. 
A1. 03/01/20. C. 
A1. 03/01/20. D. 
A2. 03/01/20. B. 
A2. 03/01/20. C. 
A2. 03/01/20. D. 
A2. 03/01/20. A.&lt;/PRE&gt;
&lt;P&gt;writing your elimination logic in a DATA step this data would become:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;A1. 03/01/20. A. 
A1. 03/01/20. B. 
A1. 03/01/20. C. 
A1. 03/01/20. D. 
A2. 03/01/20. C. 
A2. 03/01/20. D. 
A2. 03/01/20. A.&lt;/PRE&gt;
&lt;P&gt;the logic removes this record:&lt;/P&gt;
&lt;PRE&gt;A2. 03/01/20. B. 
&lt;/PRE&gt;
&lt;P&gt;When re-transposing Id use a "Do-Whitlock" loop and then recombining with the original data to re-merge duration values to arrive at what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can do something similar with arrays.&amp;nbsp; that's not as easily explained.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 20:01:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632054#M187341</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2020-03-13T20:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop a variable  when criteria is met</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632060#M187346</link>
      <description>&lt;P&gt;Third idea:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;Id. date.     Journal Duration&lt;BR /&gt;A1. 03/01/20. ABCD.   1
A2. 03/01/20. BCDA.   4&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;Take what you have but save and concatenate &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;&lt;STRONG style="font-style: normal; font-weight: bold;"&gt;Col:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt; variables into long strings.&amp;nbsp; We over here, call strings names like this "Journey" or "Journal" because they usually are chronologically ordered for us.&amp;nbsp; Using appropriate logic, change the Journal strings with F&lt;FONT size="3"&gt;ind&lt;/FONT&gt;(), &lt;FONT size="3"&gt;Scan&lt;/FONT&gt;(), &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;SubStr&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;(), &lt;/SPAN&gt;&lt;FONT size="3" style="background-color: transparent; color: #333333; font-family: &amp;amp;quot; helevticaneue-light&amp;amp;quot;,&amp;amp;quot;helvetica neue&amp;amp;quot;,helvetica,arial,sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; line-height: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;TranWRD&lt;/FONT&gt;&lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;(), etc. to arrive at what you want.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I employ &lt;SPAN style="display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'HelevticaNeue-light','Helvetica Neue',Helvetica,Arial,sans-serif; font-size: 14px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"&gt;regular expressions (i.e. PRXmatch() etc.)&amp;nbsp; to make matches in this context, because it eliminates a lot of if-then structures, but maybe your logic is simple enough to avoid regexp.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Mar 2020 20:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-a-variable-when-criteria-is-met/m-p/632060#M187346</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2020-03-13T20:19:18Z</dc:date>
    </item>
  </channel>
</rss>

