BookmarkSubscribeRSS Feed
Cfert13
Calcite | Level 5

Hi all, I am attempting to use Proc SQL to combine values (Total_XP_Made) of specific players (as each player has multiple observations within the data set) based on a dummy variable I have created along with it (Pre_or_post_change). Below is the code itself, let me know if additional information is needed.

 

proc sql;
create table KID1 as
select distinct a.player, a.pre_or_post_change, a.Total_XP_made,
(case
when a.pre_or_post_change = 0 then sum(a.Total_XP_Made)
else 'None'
end) as XpMade
from KickersInfoDiff as a
group by Player;
quit;

1 REPLY 1
kiranv_
Rhodochrosite | Level 12

problem  is  (case
when a.pre_or_post_change = 0 then sum(a.Total_XP_Made)
else 'None'
end)

 

you have  sum(a.Total_XP_Made) and 'None' for same variable XpMade, of which one value is numeric and another one is character

 

Try change 'None' to  .( a missvalue for numeric variable)

 

 

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand in the Innovate Hub.

Watch Now →
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2005 views
  • 0 likes
  • 2 in conversation