BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
data sales;
input product $ date :date9. sales;
format date date9.;
datalines;
a 1Jan2012 200
b 4Jan2012 300
c 2Feb2012 200
d 3Mar2012 200
d 5Mar2012 100
;
run;


proc summary data=have nway;
class  product;
var date sales ;
output out=summary (drop=_:) sum=;
run;

proc sql;
select product,sum(sales) as total_salees 
from have
group by product;
quit;

Required output using proc sql

Obs product date sales
1 a 01JAN2012 200
2 b 04JAN2012 300
3 c 02FEB2012 200
4 d 06MAY2064 300
3 REPLIES 3
PaigeMiller
Diamond | Level 26

What is the question? You never explain, you just throw data at us and give us no clue about what you are doing; please stop doing this. Please ask clear questions from now on and give clear explanations of what you are doing and why you are doing it.

--
Paige Miller
ballardw
Super User

Please explain how input dates of

 3Mar2012 
 5Mar2012

become

06MAY2064

in your "required output using proc sql".

Really? You want a date that is 50 or more years later than the dates given??? And in a different month?

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 842 views
  • 0 likes
  • 4 in conversation