BookmarkSubscribeRSS Feed
sufiya
Quartz | Level 8

Hi,

Would anyone know how to, by using PROC SQL merge duplicate variables rows and this would result in a sum up of one column?

tried SELECT DISTINCT and GROUP BY but I am still receiving multiple duplicates. 

4 duplicate rows showing for each Product #... if I do  PROC SORT nodupkey then it will remove all but 1 and the amount for Jan will not be correct...

please HELP 

 

this is what I am getting 

Product#JAN_CODEJAN_AMOUNTFEB_CODEFEB_AMOUNT
73560136VCRD10_126.38VCRD10_1210
73560136VCRD10_123.62VCRD10_1210
73560136VCRD10_126.38VCRD10_1210
73560136VCRD10_123.62VCRD10_1210
75458710VCRD10_123.02VCRD10_1210
75458710VCRD10_126.98VCRD10_1210
75458710VCRD10_123.02VCRD10_1210
75458710VCRD10_126.98VCRD10_1210
76307732VCRD10_127.89VCRD10_1210
76307732VCRD10_122.11VCRD10_1210
76307732VCRD10_127.89VCRD10_1210
76307732VCRD10_122.11VCRD10_1210
79854058VCRD10_123.02VCRD10_1210
79854058VCRD10_126.98VCRD10_1210
79854058VCRD10_123.02VCRD10_1210
79854058VCRD10_126.98VCRD10_1210

 

 

but what I want is 

 

Product#JAN_CODEJAN_AMOUNTFEB_CODEFEB_AMOUNT
73560136VCRD10_1210VCRD10_1210
75458710VCRD10_1210VCRD10_1210
76307732VCRD10_1210VCRD10_1210
79854058VCRD10_1210VCRD10_1210
2 REPLIES 2
ballardw
Super User

I would look at steps prior and ensure that the duplicates aren't made. Likely doing the sum before the "merge" might help.

 

PGStats
Opal | Level 21

Please make us a small example with input data and code.

PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 480 views
  • 0 likes
  • 3 in conversation