Hello everybody! I created a table with hockey players and a running total of their career points using the DATA step and an input table, but I need to recreate the same output using proc SQL, and I'm having a bit of trouble. Here's the code with the DATA step: data mydata.career_points_data;
set mydata.player_datamerged;
where league="NHL";
drop place_of_birth g a pim league;
by player_id league_year;
if first.player_id=1 then
CAREER_POINTS=0;
CAREER_POINTS+P;
run; And I tried to create code with the same output with proc SQL to no avail: proc sql;
create table career_points_sql as select player_id, first_name, last_name,
date_of_birth, height_cm, weight_kg, shoots, primary_pos, gp, league_year, p,
ppg, CAREER_POINTS+P as CAREER_POINTS
from mydata.player_datamerged where league="NHL" order by player_id, league_year;
quit; Based on the log, I'm pretty sure the text I made red is what's causing issues, but I'm not sure how to do what I want in proc SQL. I attached my log, the errors start at line 36, where I ran the code with "CAREER_POINTS+P as CAREER_POINTS" commented out. So basically I'm trying to create a table with proc SQL that has an accumulating row that resets with every new player. I also attached the table that I created with the DATA step for reference; that is what I'm trying to recreate using proc SQL. Any help is appreciated, Thanks!!
... View more