%let gameid=0049700088; /*This is the last game of 1997-1998*/ %let url="http://stats.nba.com/stats/playbyplay?GameId=&gameid%str(&)StartPeriod=1%str(&)EndPeriod=6"; %let my_proxy=;/*Insert your Proxy Server here*/ filename temp_url url &url proxy="&my_proxy"; data my_data_game; length next_record $300; infile temp_url /*lrecl=1073741823*/ lrecl=1000000 dlm="[]" pad; input next_record @@; GAME_ID=TRANWRD(scan(next_record,1,","),'"',''); EVENTNUM=INPUT(TRANWRD(scan(next_record,2,","),'"',''),BEST.); EVENTMSGTYPE=INPUT(TRANWRD(scan(next_record,3,","),'"',''),BEST.); EVENTMSGACTIONTYPE=INPUT(TRANWRD(scan(next_record,4,","),'"',''),BEST.); PERIOD=INPUT(TRANWRD(scan(next_record,5,","),'"',''),BEST.); WCTIMESTRING=TRANWRD(scan(next_record,6,","),'"',''); PCTIMESTRING=TRANWRD(scan(next_record,7,","),'"',''); HOMEDESC=TRANWRD(scan(next_record,8,","),'"',''); NEUTRALDESC=TRANWRD(scan(next_record,9,","),'"',''); VISITORDESC=TRANWRD(scan(next_record,10,","),'"',''); SCORE=TRANWRD(scan(next_record,11,","),'"',''); SCOREMARGIN=TRANWRD(scan(next_record,12,","),'"',''); if GAME_ID not eq "" and EVENTNUM>=0 then output; run; /*To get all games from 1997-1998 just get all shots of Jordan from 1997-98 and loop over distinct game-id's*/