BookmarkSubscribeRSS Feed
Anandkvn
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 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

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