<?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: Prioritising a variable whilst doing a 50/50 Split in EG in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477064#M30982</link>
    <description>&lt;P&gt;Make up some example data, post it here in a data step (see my footnotes for how to post code), and also post the expected output from that.&lt;/P&gt;
&lt;P&gt;Since SAS does not have the concept of cells, but works (like any database) with rows and columns, it's hard to get a mental picture from what you wrote.&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jul 2018 13:14:58 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-07-11T13:14:58Z</dc:date>
    <item>
      <title>Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477025#M30976</link>
      <description>&lt;P&gt;Hi am currently trying to split a cell 50/50&amp;nbsp;but I need to prioritise a variable to appear in the first cell.&amp;nbsp;Example:&lt;/P&gt;&lt;P&gt;Table&amp;nbsp;A has priority 1 &amp;amp; 2 cells, which I need to split 50/50&amp;nbsp;yet it's currently moving all priority 1 into cell 1 and then splitting priority 2 50/50 between cell 1 &amp;amp; 2. Therefore cell 1 has 20k of priority 1 and 35k of priority 2 and cell 2 just has 35k priority 2.&amp;nbsp;It's easy enough to do this if I know what volumes are involved by&amp;nbsp;a count but I&amp;nbsp;would prefer a random split.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to achieve:&lt;/P&gt;&lt;P&gt;Table A = 90k&lt;/P&gt;&lt;P&gt;cell1 = 20k priority 1&lt;/P&gt;&lt;P&gt;cell1 = 25k priority 2&lt;/P&gt;&lt;P&gt;cell2 = 45k priority 2&lt;/P&gt;&lt;P&gt;total = 90k&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently have:&lt;/P&gt;&lt;P&gt;Table A = 90k&lt;/P&gt;&lt;P&gt;cell1 = 20k priority 1&lt;/P&gt;&lt;P&gt;cell1 = 35k priority 2&lt;/P&gt;&lt;P&gt;cell2 = 35k priority 2&lt;/P&gt;&lt;P&gt;total = 90k&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The information is very sensitive so difficult to insert code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 10:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477025#M30976</guid>
      <dc:creator>hitch</dc:creator>
      <dc:date>2018-07-11T10:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477064#M30982</link>
      <description>&lt;P&gt;Make up some example data, post it here in a data step (see my footnotes for how to post code), and also post the expected output from that.&lt;/P&gt;
&lt;P&gt;Since SAS does not have the concept of cells, but works (like any database) with rows and columns, it's hard to get a mental picture from what you wrote.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 13:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477064#M30982</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-11T13:14:58Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477109#M30984</link>
      <description>&lt;P&gt;First question: Are you trying to do this with the EG point-and-click facilities, or are you using SAS code in a code window?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second: I'm afraid that I don't understand your requirements. Could you elaborate a little more on what the data stores look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 14:49:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477109#M30984</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2018-07-11T14:49:33Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477352#M31000</link>
      <description>&lt;P&gt;Morning, I am actually using SAS code in a code window&amp;nbsp;rather than point and click in EG. My data contains 89,382 records which I need to split out into two separate cells but I need to prioritise one of the cells above the other. I was doing the following code to randomly sort them out but this wouldn't allow me to prioritise the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = cell002;
by priority;
run;

/* ALSO CELL 002 SPLIT 50% WITH CELL 003 */
data cell002_003;
	set cell002; 
	if priority = '2' and mod (_n_,2) = 1
		then do;
				cellid = '003';
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.JPG" style="width: 286px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21742iA0FC236654DD4FE2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.JPG" alt="Capture1.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found the only way I could get around this was to use the count feature but this required me to know the exact volumes before hand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data = cell002;
by priority;
run;

/* ALSO CELL 002 SPLIT 50% WITH CELL 003 */
data cell002_003;
	set cell002; 
	if _n_ &amp;lt;= 44691 then cellid = '002';
	else if _n_ &amp;gt; 44691 then cellid = '003';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.JPG" style="width: 298px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21743i04ECA622765DCC89/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.JPG" alt="Capture2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Am not sure if this help you at all as it's not the easiest to explain. But I need cell's 002 &amp;amp; 003 to hold equal volumes but I also need to prioritise 19,176 records that have the variable Priority that's equal to 1 into cell002 and then the remaining split out.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 07:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477352#M31000</guid>
      <dc:creator>hitch</dc:creator>
      <dc:date>2018-07-12T07:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477354#M31001</link>
      <description>&lt;P&gt;Try this (automatically retrieve the observation count):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data cell002;
set sashelp.class (rename=(sex=priority));
run;

proc sort data=cell002;
by priority;
run;

proc sql noprint;
select int(nobs/2) into :nobs_half
from dictionary.tables
where libname = 'WORK' and memname = 'CELL002';
quit;

data cell002_003;
set cell002; 
if _n_ &amp;lt;= &amp;amp;nobs_half
then cellid = '002';
else cellid = '003';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jul 2018 07:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477354#M31001</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-12T07:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477362#M31002</link>
      <description>&lt;P&gt;Hi it seems to be falling over immediately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;32         proc sql noprint;
33         	select int(nobs/2) into :nobs_half
34         	from dictionary.tables
35         	where libname = 'work' and memname = 'cell002';
NOTE: No rows were selected.
36         quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           0.00 seconds
      user cpu time       0.00 seconds
      system cpu time     0.00 seconds
      memory              5160.37k
      OS Memory           38316.00k
      Timestamp           12/07/2018 08:51:55 AM
      Step Count                        82  Switch Count  34
      Page Faults                       0
      Page Reclaims                     13
      Page Swaps                        0
      Voluntary Context Switches        84
      Involuntary Context Switches      1
      Block Input Operations            0
      Block Output Operations           0
      

37         
38         data cell002_003;
39         	set work.cell002;
40         		if _n_ &amp;lt;= &amp;amp;nobs_half
WARNING: Apparent symbolic reference NOBS_HALF not resolved.
40         		if _n_ &amp;lt;= &amp;amp;nobs_half
                       _
                       22
ERROR 22-322: Syntax error, expecting one of the following: a name, 
              a quoted string, a numeric constant, a datetime constant, 
2                                The SAS System    07:45 Thursday, July 12, 2018

              a missing value, bitstring, INPUT, PUT.  

41         		then cellid = '002';
                  ______ _
                  180    180
ERROR 180-322: Statement is not valid or it is used out of proper order.

42         		else cellid = '003';
43         run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.CELL002_003 may be incomplete.  When this step was 
         stopped there were 0 observations and 74 variables.
WARNING: Data set WORK.CELL002_003 was not replaced because this step was 
         stopped.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jul 2018 07:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477362#M31002</guid>
      <dc:creator>hitch</dc:creator>
      <dc:date>2018-07-12T07:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477379#M31004</link>
      <description>thanks you, just changed some of the code and works perfectly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Thu, 12 Jul 2018 10:07:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477379#M31004</guid>
      <dc:creator>hitch</dc:creator>
      <dc:date>2018-07-12T10:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: Prioritising a variable whilst doing a 50/50 Split in EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477382#M31005</link>
      <description>&lt;P&gt;As you probably noticed, library and member names in SAS are always uppercase. Only variable names can have mixed case.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 10:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Prioritising-a-variable-whilst-doing-a-50-50-Split-in-EG/m-p/477382#M31005</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-12T10:21:07Z</dc:date>
    </item>
  </channel>
</rss>

