Hi, have get stuck in a thing with SAS. I should compare 4 different companys income during a period in three country in different county.In the table i only want to pick the company with highest total income for each county in every country.
the table look something like this:
Country.........County........Company.......Income
Country1.......Countyx......Compay1.......45000
......................................Company2.....45600
......................................Company3.....30566
......................................Company4.....38000
.
.
.
.
.
.
Country3.....Countyz......Company1......360000
....................................Company2......500000
....................................Company3......32100
....................................Company4......200000
That i want is to only get the bold lines in a table.
You can sort the tables in descending income order then, in a data step, include a by desceding income and include an if first.income statement. Or, you could use proc sql and use a where income eq max(income( statement.
Ok, thanks!
nodupkey option of proc sort will keep the first obs.
So if you have already sort your data as you want. then you will get the max obs.
data class;
set sashelp.class;
run;
proc sort data=class ;
by sex decending weight;
run;
proc sort data=class out=cl nodupkey ;
by sex;
run;
Ksharp
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.