proc summary data=have;
var users:;
output out=want sum=;
run;
proc transpose data=want out=want1;
var users:;
run;
Agreeing with @Kurt_Bremser that putting years into variable names is a particularly poor choice, perhaps not so much in this simple example, but certainly in the long run you want to AVOID years (or other calendar information) in variable names as it will make your programming more difficult.
With regard to @mkeintz's solution, certainly you can do this in one data step, but the code he provides is usually beyond the ability of most programmers to create, and is (in my opinion) rather complicated for what is a relatively simple problem. I don't want users (especially new SAS users) to get the impression that finding sums or counts requires such complicated code. In any case, I recommend using built-in SAS PROCs whenever possible, as I show above.
Complicated code or multi-step code is avoided by originally creating the data into a more SAS-friendly structure. Instead of years in the variable names, year should be a variable itself.
data have;
input user $ year;
cards;
jjones 2016
jjones 2017
asmith 2016
asmith 2017
asmith 2018
;
With this layout, the calculations are done with very simple code
proc freq data=have;
tables year/noprint out=want(drop=percent);
run;
... View more