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?

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 426 views
  • 0 likes
  • 4 in conversation