Hi everyone
If I have a bunch of data from 1990-2000, with various variables say: Individual. Size of salary, Years of education,
Is it possible in SAS to choose a single year (lets say 1995) and a variable (size of salary) then run a command to obtain the mean, median, maximum and minimum salaries for the given year?
If so, thats great, what shouuld I be typing?
I think you should post some sample data to clarify your question . Are they lots of datasets when you refer to 1995-2012?
data _2011; input Individual Size_of_salary Years_of_education ; cards; Kmart 2001 68,945 003144 KO Kmart 2002 69,637 003144 KO Kmart 2003 70,453 003144 KO Kmart 2004 67,394 003144 KO Kmart 2005 67,525 003144 KO Kmart 2006 67,000 003144 KO Kmart 2007 65,324 003144 KO Kmart 2008 66,667 003144 KO Kmart 2009 68,734 003144 KO Kmart 2010 70,452 003144 KO Kmart 2011 71,861 003144 KO Kappa 2001 18 003144 Ky Kappa 2002 20 003144 Ky Kappa 2003 15 003144 Ky Kappa 2004 21 003144 Ky Kappa 2005 16 003144 Ky Kappa 2006 17 003144 Ky Kappa 2007 14 003144 Ky Kappa 2008 20 003144 Ky Kappa 2009 21 003144 Ky Kappa 2010 16 003144 Ky Kappa 2011 18 003144 Ky ; run; data _2012; input Individual Size_of_salary Years_of_education ; cards; Kmart 2001 68,945 003144 KO Kmart 2002 69,637 003144 KO Kmart 2003 70,453 003144 KO Kmart 2004 67,394 003144 KO Kmart 2005 67,525 003144 KO Kmart 2006 67,000 003144 KO Kmart 2007 65,324 003144 KO Kmart 2008 66,667 003144 KO Kmart 2009 68,734 003144 KO Kmart 2010 70,452 003144 KO Kmart 2011 71,861 003144 KO Kappa 2001 18 003144 Ky Kappa 2002 20 003144 Ky Kappa 2003 15 003144 Ky Kappa 2004 21 003144 Ky Kappa 2005 16 003144 Ky Kappa 2006 17 003144 Ky Kappa 2007 14 003144 Ky Kappa 2008 20 003144 Ky Kappa 2009 21 003144 Ky Kappa 2010 16 003144 Ky Kappa 2011 18 003144 Ky ; run; %let year=2012; %let var=size_of_salary; proc means data=_&year min max mean median ; var &var ; run;
Ksharp
individual | income pp | years ed | productivity no | savings | no. shares owned | debt |
CALGENE INC | 10462 | 3.630535 | 25.2882 | 3267.015 | 512.987 | 6658.591 |
ECOSCIENCE CORP/DE | 77321 | 2.308368 | 12.7806 | 2738.213 | 1256.354 | 21792.24 |
OPTIMAX INDUSTRIES INC | 76862 | 0.811375 | 20.2394 | 682.1 | 142.287 | 32.614 |
BIOTECHNICA INTL INC | 18287 | 3.202218 | 2.2914 | 3.238 | 51.472 | 0 |
MARGO CARIBE INC | 11082 | 1.302641 | 1.7586 | 74.078 | 32.864 | 194.929 |
ML MACADAMIA ORCHARDS -LP | 69534 | 2.313228 | 27.1394 | 4165 | 527.241 | 4459 |
MYCOGEN CORP | 11450 | 4.762396 | 12.0164 | 340.715 | 105.57 | 2.411 |
CHAI NA TA CORP | 78136 | 2.948955 | 3.6181 | 2900.99 | 889.466 | 2726.662 |
NORTHLAND CRANBERRIES -CL A | 11614 | 3.081176 | 12.0042 | 363.376 | 64.153 | 16.973 |
ALICO INC | 11790 | 3.502188 | 1.3803 | 0 | 34.774 | 448 |
SYLVAN INC | 76264 | 4.246193 | 26.1076 | 473.32 | 46.127 | 341.043 |
DELTA & PINE LAND CO | 79255 | 4.212453 | 6.1842 | 53.354 | 27.722 | 0 |
DEKALB GENETICS CORP -CL B | 12006 | 5.768321 | 15.6967 | 79.315 | 20.263 | 0.239 |
SAVIA SA DE CV | 80197 | 6.168191 | 0.8492 | 32.612 | 51.697 | 32.957 |
PIONEER HI-BRED INTERNATIONL | 63096 | 7.298913 | 0.1057 | 17.896 | 53.931 | 0 |
SUNAIR SERVICES CORP | 37022 | 0.914289 | 13.452 | 317.503 | 84.825 | 0.841 |
VCA ANTECH INC | 77056 | 3.743202 | 11.6632 | 67.967 | 44.785 | 37.726 |
BAREFOOT INC | 77022 | 4.553435 | 71.1334 | 109.5 | 61.798 | 2482.2 |
SERVICEMASTER CO | 71116 | 8.001424 | 8.4419 | 43.792 | 34.63 | 39.151 |
POPE RESOURCES/DE -LP | 77012 | 3.418251 | 4.4884 | 7.045 | 27.405 | 1.139 |
RAYONIER TIMBERLANDS -LP | 68662 | 5.1301 | 6.1698 | 35.531 | 17.608 | |
IP TIMBERLANDS -LP-CL A | 67272 | 5.911726 | 3.3021 | 99.781 | 18.185 | 6.219 |
KAT EXPLORATION INC | 80842 | 2.209921 | 25.6909 | 52.344 | 14.609 | 4.988 |
NORD RESOURCES CORP | 66288 | 4.269614 | 0.2869 | 70 | 58.205 | 11.5 |
KWG RESOURCES INC | 81092 | 0.596636 | 10.8354 | 1.852 | 8.951 | 0.662 |
NORD PACIFIC LTD | 78726 | 2.424183 | 0.117 | 4.107 | 32.283 | 2.632 |
O'OKIEP COPPER CO -ADR | 34884 | 3.936306 | 4.4602 | 31.452 | 22.069 | 66.474 |
BENGUET CORP | 24029 | 4.855049 | 2.0622 | 8.464 | 10 | 14.522 |
CLIFFS NATURAL RESOURCES INC | 27422 | 5.938855 | 3.9327 | 11.474 | 24.176 | 0.557 |
COMINCO LTD | 30672 | 7.001183 | 22.9577 | 0 | 47.424 | 0 |
FREEPORT-MCMORAN COP&GOLD | 75294 | 7.100261 | 6.5081 | 22.152 | 9.788 | 1.681 |
CYPRUS AMAX MINERALS CO | 87127 | 7.93308 | 8.4651 | 92.955 | 36.457 | 3.881 |
RIO TINTO GROUP (GBP) | 76221 | 8.196009 | 4.5088 | 4.74 | 19.236 | 1.712 |
ANGLO AMERICAN PLC | 14382 | 7.600238 | 0.0925 | 4.555 | 57.081 | 33.079 |
PEGASUS GOLD INC | 75309 | 5.453816 | 1.676 | 4.437 | 26.506 | 10.378 |
HECLA MINING CO | 32651 | 4.857849 | 2.191 | 13.531 | 26.533 | 9.884 |
AMERICAN RESOURCE CORP INC | 79939 | 0.597737 | 17.1554 | 105.691 | 33.379 | 3.461 |
AMAX GOLD INC | 75111 | 4.549657 | 9.5526 | 1.296 | 30.042 | 0 |
MERIDIAN GOLD INC | 75058 | 4.148975 | 2.3313 | 1.891 | 21.372 | 0 |
GOLDEN STAR RESOURCES LTD | 79636 | -0.54473 | 0.39 | 2.896 | 23.983 | 1.779 |
REAL DEL MONTE MINING CP | 76939 | 2.700085 | 0.668 | 3.41 | 23.482 | 1.631 |
BLYVOORUITZICHT GOLD MINING | 18543 | 4.20414 | 17.2403 | 35.396 | 16.096 | 117.114 |
STANDARD MINING CORP | 79816 | -1.59455 | 2.3212 | 5.523 | 32.018 | 29.533 |
VISTA GOLD CORP | 69446 | 3.996952 | 0.217 | 1.605 | 41.906 | 7.663 |
GREAT CENTRAL MINES NL | 79030 | 1.070556 | 19.2858 | 130.573 | 22.635 | 16.337 |
GREENSTONE RESOURCES LTD | 78695 | 1.558776 | 1.4821 | 2.578 | 20.828 | 0.921 |
DAKOTA MINING CORP | 75883 | 2.133219 | 6.1682 | 10.543 | 18.282 | 2.903 |
CAMBIOR INC | 80706 | 5.698525 | 1.5278 | 10.458 | 50.631 | 7.697 |
SKY SCIENTIFIC INC | 76460 | -3.35241 | 4.499 | 3.885 | 19.128 | 3.01 |
AMERICAN PAC MINERALS LTD | 77241 | 0.19062 | 1.2558 | 1.308 | 22.174 | 0.306 |
SILVERADO GOLD MINES LTD | 78365 | 0.416075 | 10.3328 | 4.61 | 7.353 | 7.021 |
USMX INC | 79151 | 2.611172 | 0.1917 | 19.547 | 233.684 | 5.296 |
SISKON GOLD CORP -CL A | 76986 | -1.57022 | 26.5695 | 34.359 | 9.803 | 10.062 |
REA GOLD CORP | 78558 | 0.386622 | 26.5695 | 34.359 | 9.803 | 10.062 |
EL CONDOR RESOURCES LTD | 78774 | -3.07911 | 7.2067 | 17.538 | 26.202 | 0 |
AMERICANA GLD&DIAMOND HLDGS | 80110 | -1.47403 | 10.9601 | 141.541 | 62.003 | 13.403 |
COMMERCE GROUP CORP | 57656 | -2.74887 | 113.2101 | 15.15 | 1.761 | 2.349 |
NORTHGATE MINERALS CORP | 49955 | 0.824175 | 3.6063 | 4.73 | 7.478 | 0 |
ALTA GOLD CO | 70691 | 2.36987 | 0.5728 | 1.279 | 19.096 | 0 |
CANYON RESOURCES CORP | 10042 | 2.974509 | 4.7991 | 24.58 | 31.717 | 2.478 |
MK RESOURCES CO | 79997 | 3.665406 | 10.5572 | 236.8 | 33.38 | 0 |
CUSAC GOLD MINES LTD | 78271 | 2.048982 | 14.1757 | 50.762 | 24.799 | 22.564 |
CALEDONIA MINING CORP | 77563 | 2.683689 | 3.3382 | 66.559 | 48.082 | 0 |
CAMPBELL RESOURCES INC | 30154 | 3.84887 | 2.431 | 4.119 | 23.167 | 0 |
GOLDEN KNIGHT RESOURCES INC | 78535 | 3.051214 | 0.0992 | 10.441 | 12.484 | 6 |
GLAMIS GOLD LTD | 78495 | 3.959632 | 2.8373 | 7.791 | 39.449 | 11.595 |
GETCHELL GOLD CORP | 11849 | 4.555455 | 3.5835 | 3.179 | 35.283 | 0.617 |
WHARF RESOURCES LTD | 78467 | 4.014146 | 4.1467 | 2.434 | 15.02 | 0 |
AGNICO EAGLE MINES LTD | 78223 | 4.383775 | 17.4266 | 10.598 | 1495.821 | |
ECHO BAY MINES LTD | 65568 | 5.933835 | 1.3704 | 9.324 | 13.476 | 2.743 |
BATTLE MOUNTAIN GOLD CO | 85869 | 5.436643 | 5.8712 | 19.704 | 15.266 | 0 |
GOLDCORP INC | 69905 | 4.948356 | 21.6371 | 5.488 | 26.124 | 0 |
KINROSS GOLD CORP | 78395 | 4.834987 | 6.0827 | 4.626 | 13.05 | 0.462 |
ROYAL OAK MINES INC | 76809 | 5.088281 | 0.7648 | 49.889 | 114.683 | 0.154 |
NEWMONT MINING CORP | 21207 | 6.392537 | 0.1768 | 2.835 | 24.7 | 0 |
NEWMONT GOLD CO | 69585 | 6.392537 | 2.4299 | 6.284 | 17.726 | 0 |
BUFFELSFONTEIN GOLD MINES | 19669 | 5.656065 | 2.5309 | 1.383 | 11.487 | 1.024 |
HOMESTAKE MINING | 12319 | 6.486246 | 0.1135 | 2.595 | 21.695 | 0.243 |
SANTA FE PACIFIC GOLD CORP | 80694 | 5.928535 | 0.2142 | 1.178 | 29.016 | 0.355 |
HEMLO GOLD MINES INC | 77306 | 5.539517 | 3.9438 | 44.21 | 0.018 | |
WESTERN DEEP LEVELS LTD | 82211 | 6.163612 | 0.5872 | 1.281 | 40.771 | 0 |
PLACER DOME INC | 75181 | 6.801283 | 2.926 | 5.983 | 12.041 | 0.872 |
FREE STATE CONSOL GOLD MINES | 10060 | 7.140378 | 2.6004 | 2.463 | 20.936 | 0 |
ANGLOGOLD ASHANTI LTD | 79899 | 6.768962 | 2.3706 | 2.924 | 11.007 | 0 |
KLOOF GOLD MINING CO LTD | 47934 | 6.314242 | 1.5382 | 1.619 | 22.523 | 0 |
GOLD FIELDS LTD | 30796 | 6.562636 | 14.6297 | 44.323 | 26.59 | 0 |
BARRICK GOLD CORP | 71298 | 6.841722 | 2.3863 | 7.628 | 12.555 | 0.829 |
COEUR D'ALENE MINES CORP | 24441 | 4.511112 | 1.6687 | 2.062 | 12.662 | 0.087 |
NORTH AMERICAN PALLADIUM | 79853 | 3.033413 | 1.0537 | 1.207 | 63.649 | 0 |
URANIUM RESOURCES INC | 75672 | 2.85267 | 0.9274 | 3.145 | 30.569 | 0.01 |
STILLWATER MINING CO | 81173 | 4.070803 | 9.5109 | 0.896 | 8.151 | 2.608 |
SOUTHERN ENERGY CO INC | 78952 | 2.705514 | 2.8508 | 81.565 | 53.738 | 7.022 |
AMERICA WEST RESOURCES INC | 77364 | 3.044665 | 19.095 | 108.048 | 3 | 30 |
ARCH COAL INC | 75326 | 6.413695 | 4.1263 | 11.654 | 11.673 | 1.385 |
ZEIGLER COAL HOLDING CO | 80868 | 6.769516 | 0.2336 | 0.348 | 16.201 | 0.197 |
PENNZENERGY CO | 35211 | 7.813927 | 6.172 | 11.108 | 13.085 | 0.34 |
UNITED MERIDIAN CORP | 79455 | 4.589711 | 2.9988 | 23 | 81.266 | 23.9 |
TRITON ENERGY LTD | 61217 | 3.849594 | 0.8173 | 0.462 | 6.586 | 0.319 |
XCL LTD | 11571 | 1.466952 | 1.6276 | 7.433 | 18.681 | 6.61 |
LOUISIANA LAND & EXPLORATION | 33814 | 6.662494 | 0.0448 | 2.418 | 14.501 | 0.439 |
AMERICAN EXPLORATION CO | 12811 | 3.916991 | 2.3341 | 0.87 | 19.716 | 2.424 |
CHIEFTAIN INTL INC | 75478 | 3.405156 | 3.3207 | 8.344 | 17.407 | 2.102 |
GOODRICH PETROLEUM CORP | 57509 | 2.500042 | 1.7026 | 1.569 | 17.04 | 1.188 |
NUEVO ENERGY CO | 76238 | 4.779754 | 1.0143 | 0.556 | 15.357 | 4.62 |
WICHITA RIVER OIL | 38105 | 1.557513 | 3.5527 | 18.879 | 3.143 |
is there a simplier method? than listing your whole sample size in the command. I have a lot more data
Check it out,This can give you some GUI which is very convenient .
How do you get the YEAR out of this data? I don't see a likely field.
spraynardz90
we would need just enough sample data to indicate data structure, because SAS will deal with the detail.
SAS can analyse your data, providing almost any statistic you can imagine
In Enterprise Guide, you need to point/load your data, then perform "tasks" upon it.
Probably the kind of tasks you need to use are among "Describe data"
hope this gets you started
good luck
peterC
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.