<?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 Random sorting when combining data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517940#M140101</link>
    <description>&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;length Teammate $50;&lt;/P&gt;
&lt;P&gt;input Process $&amp;nbsp; Teammate $;&lt;/P&gt;
&lt;P&gt;datalines&lt;/P&gt;
&lt;P&gt;AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; John&lt;/P&gt;
&lt;P&gt;AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp; Charles&lt;/P&gt;
&lt;P&gt;BBBB&amp;nbsp; Samuel&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input_record&lt;/P&gt;
&lt;P&gt;LN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TEAMMATE&lt;/P&gt;
&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AAAA&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BBBB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;CREATE TABLE COMBINE AS&lt;/P&gt;
&lt;P&gt;SELECT *&lt;/P&gt;
&lt;P&gt;FROM HAVE&amp;nbsp; A&lt;/P&gt;
&lt;P&gt;LEFT JOIN INPUT_RECORD&amp;nbsp; B&lt;/P&gt;
&lt;P&gt;ON A.PROCESS = B.PROCESS&lt;/P&gt;
&lt;P&gt;;QUIT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I run this code process AAAA will be assigned to teammate &amp;nbsp;&amp;nbsp; John for both 1 and 2.&amp;nbsp; Is there a way to assigned this randomly (John would get 1 and Charles would get 2).&amp;nbsp; The reason for this is because the customer provided a spreadsheet similar to input_record in which multiple people can be assigned the same process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Dec 2018 00:41:29 GMT</pubDate>
    <dc:creator>Q1983</dc:creator>
    <dc:date>2018-12-03T00:41:29Z</dc:date>
    <item>
      <title>Random sorting when combining data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517940#M140101</link>
      <description>&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;length Teammate $50;&lt;/P&gt;
&lt;P&gt;input Process $&amp;nbsp; Teammate $;&lt;/P&gt;
&lt;P&gt;datalines&lt;/P&gt;
&lt;P&gt;AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; John&lt;/P&gt;
&lt;P&gt;AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp; Charles&lt;/P&gt;
&lt;P&gt;BBBB&amp;nbsp; Samuel&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;input_record&lt;/P&gt;
&lt;P&gt;LN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TEAMMATE&lt;/P&gt;
&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AAAA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AAAA&lt;/P&gt;
&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BBBB&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;/P&gt;
&lt;P&gt;CREATE TABLE COMBINE AS&lt;/P&gt;
&lt;P&gt;SELECT *&lt;/P&gt;
&lt;P&gt;FROM HAVE&amp;nbsp; A&lt;/P&gt;
&lt;P&gt;LEFT JOIN INPUT_RECORD&amp;nbsp; B&lt;/P&gt;
&lt;P&gt;ON A.PROCESS = B.PROCESS&lt;/P&gt;
&lt;P&gt;;QUIT&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I run this code process AAAA will be assigned to teammate &amp;nbsp;&amp;nbsp; John for both 1 and 2.&amp;nbsp; Is there a way to assigned this randomly (John would get 1 and Charles would get 2).&amp;nbsp; The reason for this is because the customer provided a spreadsheet similar to input_record in which multiple people can be assigned the same process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 00:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517940#M140101</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2018-12-03T00:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Random sorting when combining data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517944#M140102</link>
      <description>&lt;P&gt;use a merge instead of join&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;

length Teammate $50;

input Process $  Teammate $;

datalines;

AAAA     John

AAAA    Charles

BBBB  Samuel
;
run;



data
input_record;
input 
LN     PROCESS  $    ;
datalines;
1      AAAA    
2      AAAA
3      BBBB
;
data want;
merge have(in=a) input_record(in=b);
by process;
if a;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that should solve this&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 01:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517944#M140102</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-12-03T01:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Random sorting when combining data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517947#M140104</link>
      <description>&lt;P&gt;A SQL Query would produce a Cartesian product&amp;nbsp; ( 5 rows in the sample output, 2 rows each for the repeated values) , are you sure is that is what you intend ?&amp;nbsp; .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If "&lt;SPAN&gt;John would get 1 and Charles would get 2" is the only criteria use a data step merge instead. Not sure what you meant by "Random" in the example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 01:52:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/517947#M140104</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-03T01:52:42Z</dc:date>
    </item>
    <item>
      <title>Re: Random sorting when combining data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518148#M140187</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given the OP's description of the objective, this solution depends ENTIRELY on&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Each dataset having the same order of by-groups.&amp;nbsp; (But that can be solved by a proc sort).&lt;/LI&gt;
&lt;LI&gt;The two datasets having exactly then same number of records per by-group.&amp;nbsp; Otherwise, whichever merged data set has a smaller number of within-by-group records&amp;nbsp;will have its final&amp;nbsp;values "retained" through all the "extra" records from the other data set.&lt;/LI&gt;
&lt;LI&gt;Each dataset having the same order within by-groups.&amp;nbsp; Otherwise, there is no apparent variable to validate a match.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In other words, can the OP trust his data providers to be that consistent?&amp;nbsp;&amp;nbsp; Having a blank teammate variable, which would ordinarily be a match-key, diminishes one's confidence in the data provider.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 16:41:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518148#M140187</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2018-12-03T16:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: Random sorting when combining data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518160#M140192</link>
      <description>&lt;P&gt;you are so right&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 17:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518160#M140192</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-12-03T17:22:38Z</dc:date>
    </item>
    <item>
      <title>Sequence randomly in dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518181#M140217</link>
      <description>&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Process Teammate $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;50&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Process $ Teammate$;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;POC James&lt;/P&gt;
&lt;P&gt;POC Sam&lt;/P&gt;
&lt;P&gt;POC Jane&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;length&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; Process Teammate $&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;50&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt; ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;input&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; ln Process $ Teammate $ ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;datalines&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;12 POC James&lt;/P&gt;
&lt;P&gt;55 POC&lt;/P&gt;
&lt;P&gt;60 POC&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;run&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; merge1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;merge&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; have1 have2;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;if&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; process = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'POC'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;OUTPUT&lt;/P&gt;
&lt;P&gt;ln Process Teammate&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC James&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;55&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;60&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I modify the code to randomly assign the teammate in a sequencr of&lt;/P&gt;
&lt;P&gt;James, Sam Jane&lt;/P&gt;
&lt;P&gt;ln Process Teammate&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;12&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC James&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;55&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC Sam&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;60&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC Jane&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;72&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC James &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;88&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC Sam&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;99&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; POC Jane&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;STRONG&gt;....e&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;tc&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Dec 2018 18:44:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Random-sorting-when-combining-data/m-p/518181#M140217</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2018-12-03T18:44:47Z</dc:date>
    </item>
  </channel>
</rss>

