Hello,
I need to know how can I split the population evenly between two groups. Naming one group C and the other D
For example:
Number of population = 100
Ouput:
Group C=50
Group D=50
Please help
Thanks,
Nikki
Printable View
Hello,
I need to know how can I split the population evenly between two groups. Naming one group C and the other D
For example:
Number of population = 100
Ouput:
Group C=50
Group D=50
Please help
Thanks,
Nikki
On which rdbms? You mean split data in a table? Have more details?
Well, I am pulling data from the table. I have the total population so I am trying to split the total population into two groups for one column in the table. I want to name these groups C and D
For example:
Column name Cells from table output
total population = 100
Output needs to be:
Cells Population
C 50
D 50
Hope this helps. I think, I can do this using When statement but not sure
Thanks
Do you want to split data based on value of other column or randomly?
I have a program written in SAS and I want to distribute the total population into two groups evenly. Just randomly. So I will need to create a new dataset for this. But I am not sure how to do this.
Which rdbms do you use?
I use Oracle
May split them based on rowid.
Ok.. Like how.
Could you help me with an example?
Thanks!
Possible to post your table schema?
It's too big to post it here.
It would be great if you can just show me an example on how to do it. If you could tell me which statement to use....should I use if/else or when....I am not sure and how should I divide them into two groups
You want to split a table into two tables or what? If only need divide count in two groups to display, you can get it with count(*)/2.
so how would I distribute the total number evenly into two groups? I am not splitting the table. I only want to split the number into two groups.
For example:
total = 100
Output needs to be:
Group Total
C 50
D 50
Set total/2 for each group. Is group a column in the table? Total means number of rows in the table?
The impression I get is that you have the following :
select column1 as population from table1
column1
100
200
300
this gives you all the population values, which i'm assuming you want to split in two, so...
select (column1 / 2) as group c, (column1 / 2) as group d from table1
group c | group d
50 | 50
100 | 100
150 | 150
If this is not what you want, then you need to be clearer in what you are saying.