BookmarkSubscribeRSS Feed
Conleyw18
Calcite | Level 5

I have game stats from the 2018-2019 NBA season but some data values are double counted with the team names switching variables. This is what the data looks like. Not all observations have this issue this is just what It looks like at certain points in the data 

 

 

22UTA10/22/2018

MEM

23OKC10/22/2018

GSW

24MEM10/22/2018

UTA

25GSW10/22/2018UTA
2 REPLIES 2
ballardw
Super User

If this were my data I would be tempted to place the team names in order and then sort the data, removing duplicates:

 

Something like:

data have;
   input num teama $ date :mmddyy10. teamb $;
   format date mmddyy10.;
datalines;
22	UTA	10/22/2018	MEM
23	OKC	10/22/2018	GSW
24	MEM	10/22/2018	UTA
25	GSW	10/22/2018	UTA
;

data need;
   set have;
   array t(*) teama teamb;
   call sortc(of t(*));
run;

proc sort data=need out=want nodupkey;
   by date teama teamb;
run;

You should provide example data in form of a data step as above. That way we do not have to guess variable names or properties.

 

If the ORDER of the team names is important, such as winner / loser then you would need to add additional information in the NEED data step to capture that information into a new variable.

vijaypratap0195
Obsidian | Level 7

Could you please provide us with the sample data and explain with any example where the values are doubling up?

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 387 views
  • 0 likes
  • 3 in conversation