Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey , i want to create a listbox for age group.
Ex:
AgeGroup
1-10
10-20
20-30
30-40
40-50
Above 50
I am using:
if
(Age>=10, '1-10',
if(Age>=20, '10-20',
if(Age>=20, '20-30',
if(Age>=30, '30-40',
if(Age>=40, '40-50',
if(Age>=50, 'Above 50')))))) as
AgeGroup
But i am getting:
AgeGroup
1-10
can anybody please tell me what mistake i am doing..........
the problem is all of them are >=10, son try using:
if
(Age>=50, 'Above 50',
if(Age>=40, '40-50',
if(Age>=30, '30-40',
if(Age>=20, '20-30',
if(Age>=10, '10-20','<10'))))) as
AgeGroup
Please use CLASS!
class( expression, interval [ , label [ , offset ]] )
Creates a classification of expressions. The bin width is determined
by the number set as interval. The result is shown as a<=x<b, where
a and b are the upper and lower limits of the bin. The x can be
replaced by an arbitrary string stated in label. 0 is normally the
default starting point of the classification. This can be changed by
adding an offset.
Examples:
class( var,10 ) with var = 23 returns '20<=x<30'
class( var,5,'value' ) with var = 23 returns '20<= value <25'
class( var,10,'x',5 ) with var = 23 returns '15<=x<25'