Like Fareeza said, such stats are easily calculated using one of the SAS procs. Your problem clearly looks like a homework assignment and, if the solution code is your own, your calculation formula is wrong. You would definitely have to capture and use N somewhere in your formula. You can easily include some minor proc sql code to capture and store the desired numbers in macro variables. And you can print them in your log so that you follow your prof's preferred approach. e.g.: proc sql; select count(*),sum(x),sum(y),sum(x**2),sum(y**2) into :n,:xsum,:ysum,:x2sum,:y2sum from Question1 ; quit; %put &n; %put &xsum; %put &ysum; %put &x2sum; %put &y2sum; Conversely, Using the proc print approach, you could do something like the following to get the desired N: proc print data=Question1 n='# of cases:' noobs; sum x y x2 y2;/*get sums of variables from this table to use in your analysis-I like this way best since I can see the actual calculations*/ run;
... View more