satish

Thursday, 24 November 2016

Extract Nth highest salary from SALARY table using Proc SQL:

Extract Nth highest salary from SALARY table using Proc SQL:


Data salary;
input sal;
cards;
23
12
.
45
0
54
-21
43
;
run;



%let N=3;
proc sql;
select a.sal from salary a where &N= (select count(distinct sal) from salary b where a.sal<=b.sal);
quit;

OUTPUT:
43

Posted by Unknown at 07:26
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ▼  2016 (38)
    • ►  December (28)
    • ▼  November (10)
      • Interview Questions
      • Extract Nth highest salary from SALARY table using...
      • How to get any kind of data in SAS? Is it possible...
      • SAS Update Statement - Combining Datasets
      • PROC DATASETS (copy, move, kill, save, modify, ren...
      • SAS Interleave - Combining Datasets using BY state...
      • SAS Merge Statement - Combining Datasets
      • SAS-Importing and Exporting from Tabs of Excel
      • SAS-PROC SORT, SAS-KEEP, SAS-NO DUPKEY, SAS-FIRST...
      • SAS - FAQs
  • ►  2015 (3)
    • ►  January (3)
  • ►  2014 (4)
    • ►  January (4)
  • ►  2013 (118)
    • ►  December (1)
    • ►  November (1)
    • ►  October (5)
    • ►  September (1)
    • ►  August (3)
    • ►  July (28)
    • ►  June (25)
    • ►  May (13)
    • ►  April (41)

About Me

Unknown
View my complete profile
Watermark theme. Powered by Blogger.