<?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: Consolidating two steps into one in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204544#M50971</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go, this way the 1.0 is a character.&amp;nbsp; If you want it to be a number remove the quotes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;input id$ group$ prefix$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;100,abc,ABC&lt;/P&gt;&lt;P&gt;200,abc,123&lt;/P&gt;&lt;P&gt;300,abc,123&lt;/P&gt;&lt;P&gt;400,qwe,123&lt;/P&gt;&lt;P&gt;500,qwe,ABC&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table test as&lt;/P&gt;&lt;P&gt;select distinct *,'1.0' as Value&lt;/P&gt;&lt;P&gt;from master&lt;/P&gt;&lt;P&gt;where prefix = 'ABC'&lt;/P&gt;&lt;P&gt;order by id,group;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jul 2015 12:43:47 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2015-07-16T12:43:47Z</dc:date>
    <item>
      <title>Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204543#M50970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;I want to combine these two steps below into one by creating the variable Value within the Master dataset itself, without using proc sort to get rid of the duplicates. Is there multiple ways of doing that?&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;proc &lt;/SPAN&gt;&lt;STRONG style=": ; color: #000080; font-size: 10pt; font-family: Courier New;"&gt;sort&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=master &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;=test &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;nodupkey&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;where prefix = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;'ABC'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;by id group;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;set &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;value = 1.0; &lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 12:27:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204543#M50970</guid>
      <dc:creator>Neil_C</dc:creator>
      <dc:date>2015-07-16T12:27:35Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204544#M50971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here you go, this way the 1.0 is a character.&amp;nbsp; If you want it to be a number remove the quotes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;input id$ group$ prefix$;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;100,abc,ABC&lt;/P&gt;&lt;P&gt;200,abc,123&lt;/P&gt;&lt;P&gt;300,abc,123&lt;/P&gt;&lt;P&gt;400,qwe,123&lt;/P&gt;&lt;P&gt;500,qwe,ABC&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table test as&lt;/P&gt;&lt;P&gt;select distinct *,'1.0' as Value&lt;/P&gt;&lt;P&gt;from master&lt;/P&gt;&lt;P&gt;where prefix = 'ABC'&lt;/P&gt;&lt;P&gt;order by id,group;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 12:43:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204544#M50971</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-16T12:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204545#M50972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mark for the proc sql method. I have more variables in this file where I was aiming to create different values for Value based on multiple if ... then else conditions. So it would be nice to change the master file instead of creating another file 'test'. Is there a similar program like below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the program would be something like&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;set master;&lt;/P&gt;&lt;P&gt;if condition1 then value = 2;&lt;/P&gt;&lt;P&gt;else if condition2 then value = 3;&lt;/P&gt;&lt;P&gt;else if ......;&lt;/P&gt;&lt;P&gt;....;&lt;/P&gt;&lt;P&gt;else if prefix&amp;nbsp; = 'ABC' .....&amp;nbsp; then value = 1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 13:30:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204545#M50972</guid>
      <dc:creator>Neil_C</dc:creator>
      <dc:date>2015-07-16T13:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204546#M50973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hash Table can do that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 13:34:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204546#M50973</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-07-16T13:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204547#M50974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it would be best to provide a sample of the data you have and give more information for what you want.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 13:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204547#M50974</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-16T13:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Consolidating two steps into one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204548#M50975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;infile cards dsd;&lt;/P&gt;&lt;P&gt;input id$ group$ prefix$ var1$ var2;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;100,abc,ABC,F,11&lt;/P&gt;&lt;P&gt;100,abc,123,F,11&lt;/P&gt;&lt;P&gt;200,abc,123,H,12&lt;/P&gt;&lt;P&gt;300,abc,123,F,11&lt;/P&gt;&lt;P&gt;400,qwe,123,H,13&lt;/P&gt;&lt;P&gt;500,qwe,ABC,F,15 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data master;&lt;/P&gt;&lt;P&gt;set master;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if prefix&amp;nbsp; = 'ABC'&amp;nbsp; then value = 1; * need to insert appropriate program here that scans through rows vertically for each combination of id &amp;amp; group, and labels Value as 1 for row containing ABC and ignores other rows. Only one row should have a value of 1 if there are multiple mentions of ABC in prefix for each id-group combination.&lt;/P&gt;&lt;P&gt;For example, for 1st two rows combination of id-group (100 &amp;amp; abc) mentioned above, only 1st row gets assigned Value as 1 and next row as missing. For the rest of rows not having prefix values of ABC the program is shown below.&lt;/P&gt;&lt;P&gt;Hope this makes sense ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else if var1 = 'F' and var2 =11 then value = 2;&lt;/P&gt;&lt;P&gt;else if var1 = 'H' and var2 =11 then value = 3;&lt;/P&gt;&lt;P&gt;else if ......;&lt;/P&gt;&lt;P&gt;else if ....;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 14:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Consolidating-two-steps-into-one/m-p/204548#M50975</guid>
      <dc:creator>Neil_C</dc:creator>
      <dc:date>2015-07-16T14:11:58Z</dc:date>
    </item>
  </channel>
</rss>

