how to get second highest salary from a employee table and
how get a 5th highest salary from a employee table?
Answer Posted / nandu
proc sort data=samp nodupkeys;
by sal descending ;
run;
data samp1 samp2;
set samp ;
ln+1 ;
if ln=2 then output samp2 ;
else samp ;
run;
/*second highest salary obs will come into samp2 dataset */
| Is This Answer Correct ? | 3 Yes | 11 No |
Post New Answer View All Answers
How can sas program be validated?
Hello, I have PROC SQLs results group by 3 fields and I use SUM and COUNT functions in SQL. The problem is when I try to display my result with PROC TABULATE. I am getting very big numbers. I believe I make a mistake some where in Tabulate. Here is my Proc Tabulate. PROC TABULATE DATA=OUT04_05 FORMAT=12.; CLASS YR CENTRE VISA / PRELOADFMT EXCLUSIVE; VAR NEWUSER FRAUD TRANSFER AUTUSER REISSUE; TABLE CENTRE ALL, (YR ALL)*VISA, (NEWUSER*F=COMMA12. AUTUSER*F=COMMA12. FRAUD*F=COMMA12. TRANSFER*F=COMMA12. REISSUE*F=COMMA12.) / MISSTEXT={LABEL='0'} PRINTMISS RTS=20; FORMAT VISA VISAFMT.; KEYLABEL SUM = ' ' ALL = 'TOTAL'; LABEL YR = 'DATE YEAR' NEWUSER = 'TOTAL NEW ACCT' TRANSFER = 'TOTAL TRANSFER' FRAUD = 'TOTAL FRAUD TRANSFER' AUTUSER = 'TOTAL AUTH USERS' REISSUE = 'TOTAL REISSUE'; When I code it like : NEWUSER*N*F=COMMA12. AUTUSER*N*F=COMMA12. I get same amount numbers but to find a NEWUSER I use COUNT(*) and to find AUTUSER I use SUM(xxxx) function so both result shouldn’t be the same my problem is in this point. Could you tell me where the problem in code is. How can I display my result? TX.
hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also?
How do you use the do loop if you don’t know how many times you should execute the do loop?
Explain data_null_?
what is the difference between infile and input? : Sas-administrator
List down the reasons for choosing sas over other data analytics tools.
how would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? : Sas programming
what do the sas log messages "numeric values have been converted to character" mean? What are the implications? : Sas programming
How to limit decimal places for the variable using proc means?
Mention common programming errors committed in sas ?
How to read an input file in sas?
What is program data vector (pdv)?
How to specify variables to be processed by the freq procedure?
how are numeric and character missing values represented internally? : Sas programming