0

I am new to SAS and struggling to convert the below piece of code to SQL.

proc rank data = input (where = (limit_assort = 1)) out = assort_rank  groups=3;
    var assort;
    ranks assort_rank;
run;

I tried in sql by using the below one but not matching with the SAS output.

Percentile_Cont(0.3) Within Group (Order by assortment) As assortment_rank

In SAS output, i can see a column "Rank for variable assort"with 0,1&2 based on the groups=3 option. But not sure how to handle it in SQl.

Thanks in advance!

Samah
  • 1
  • 1
  • 2
  • What flavor of SQL are you using? What database software are you using SQL with? – Tom Dec 28 '16 at 21:03
  • we are using nzsql (Netezza). – Samah Dec 29 '16 at 06:09
  • In SAS output, after running the above proc there is an extra column with Rank for variable assort - it is randomly dividing the observation in 3 groups (0,1,2). – Samah Dec 29 '16 at 07:04

0 Answers0