Your solution
My answer is below:
proc means data=PG1.NP_WESTWEATHER;
where Precip =0;
class name year;
ways 2;
output out=rainstats N=RainDays sum=TotalRain;
run;
has the potential to get a different result because without a VAR statement which variable gets stuck into totalrain may be problematic.
Compare the results from these two snippets:
proc means data=SASHELP.Class;
class sex ;
ways 1;
output out=work.summ1 N=count sum=total;
run;
proc means data=SASHELP.Class;
class sex;
ways 1;
var weight;
output out=work.summ2 N=count sum=total;
run;
The variable summarized in the first code is the FIRST numeric not used in class variable(if any class variables are numeric).
The second summarizes a specific variable.
When the data has few variables you may get lucky and get the same answer as needed but if the order of variables is other than expected, or not considered prior to writing the code, then you get interesting results.
Note that a frequently helpful feature of Proc Means / summary is autoname to name output variables:
proc means data=SASHELP.Class;
class sex ;
ways 1;
output out=work.summ3 n= sum= mean= / autoname;
run;
Which will create the count, sum and mean of all numeric variables (not used on class, freq or weight statements) and appends the statistic to the variable name.