DATA Step, Macro, Functions and more

Calculating AVG salary

Reply
Contributor
Posts: 39

Calculating AVG salary

how to calculate avg salry from below dataset

 

data work.talent3;
   input ID $ 1-4 Phone 6-12 @14 LastHired date9.
         @24 BirthDate date9. Height $ 34-35 Month 37-38 Day 40-41 @43 termination DATE9. @53salary @59 termin $;
   format lasthired birthdate termination date9.;
datalines;
327M 5553489 08APR2000 25APR1978 69  4  8 10JAN2014 15000 t
102M 5556012 20AUG1999 16MAR1955 70  8 20             26000 a
131F 5556781 16MAY1997 10SEP1976 64  6 25 25DEC2016    35000 t
709F 5554023 25JUN1994 08JAN1962 69  9 17            28000 a
056F 5559909 17SEP1991 31JAN1930 59 12 10            33000 a
287M 5557024 10DEC1993 14JUL1969 78 11 23            40000 a
097F 5557045 23NOV1994 17AUG1972 68 11 12 15MAY2000    21000 t
070M 5555602 12NOV1995 14FEB1946 71  3 27 20FEB2005    23000 t
217M 5558114 27MAR2000 19MAY1963 71  7 18            58000 a
118F 5559100 11OCT1998 06OCT1977 66 12  2            47000 a
187M 5553688 18JUL1996 22MAR1925 76  1  7            63000 a
035M 5555131 02DEC1998 23JUN1974 70 12  6 06JUN2008    45000 t
254F 5554950 07JAN2000 27FEB1940 63  8 25 28AUG2009    50000 t
167F 5558333 06DEC1999 27OCT1969 69  5 22 11NOV2016    39000 t
093F 5552525 25AUG1993 05NOV1963 57  2 25            42000 a
261M 5557831 22MAY1994 01NOV1965 70 11 15            24000 a
088M 5551006 25FEB2000 28MAY1950 69  9 17 15FEB2017    19000 t
134M 5559945 15NOV1998 16AUG1959 73 11  1            46000 a
207M 5556563 17SEP1996 15APR1947 67 11 25            48000 a
158F 5555613 01NOV1995 10JAN1971 65 10 28            47000 a
065M 5552709 04DEC1994 23JUL1964 60  9 30            80000 a
288M 5551856 25NOV1997 01JUL1965 73  2 22            75000 a
134F 5554442 28OCT1999 18SEP1979 69  5  5            44000 a
025F 5552442 30SEP1998 07MAY1971 65 10 15            36000 a
;run;

Super User
Posts: 6,936

Re: Calculating AVG salary

proc sql;
select avg(salary) from work.talent3;
quit;

But I guess there's more to it in your question?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 39

Re: Calculating AVG salary

yes additionally I need

based on same dataset how to calculate tenure(difference between 'lasthired' if available or else its need to take today date

 

Super User
Posts: 6,936

Re: Calculating AVG salary

Difference between lasthired and what?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 3 replies
  • 128 views
  • 1 like
  • 2 in conversation