BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
vishyy
Obsidian | Level 7

Hi

 

I am new to SAS, Please hlp me in resoving a sample business problem.

 

I have sample records below .

 

SAS-dataset.png

 

 

I need to find the total usage of each customer for Home and roaming circle.

 

Thanks 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

Gotta say, not very clear from your subject line "Using of Group".

 

Here is a datastep solution, again, not tested.

 

proc sort data = have;
	by circle;
run;

data want;
	set have;
	by circle;
	sum = sum + minutes;
	if last.circle then output;
	retain sum 0;
run;

View solution in original post

11 REPLIES 11
vishyy
Obsidian | Level 7

Sample Dataset is attached. 


Screen Shot 2017-04-27 at 12.54.15 PM.png
PeterClemmensen
Tourmaline | Level 20

Please post your data in the form of a datastep, mush easier to help that way

 

This is not tested but you are probably looking for something like this

 

proc sql;
	create table want as
	select circle
	      ,sum(minutes)
	from have
	group by circle;
quit;
vishyy
Obsidian | Level 7

I dont want to use proc sql.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Use proc means with a by group then.  

http://support.sas.com/documentation/cdl/en/proc/65145/HTML/default/viewer.htm#n0k7qr5c2ah3stn10g1lr...

 

Also, try not to limit yourself with what tools you can and can't use, they are all useful.

vishyy
Obsidian | Level 7

I am new and learning SAS, i just want to do in that way nothing else.

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

In what way, please be specific.  You have said GROUP which indicates SQL, then you say you don't want to use that.  So the next option is using a procedure designed to create means output - proc means, however this also doesn't seem to fit what you want.  So please be clear in your posts exactly what it is you want so we don't go through these loops of trying to figure it out.  

vishyy
Obsidian | Level 7

I am new and learning SAS, i just want to do in that way nothing else.

Thanks for nudging. 

PeterClemmensen
Tourmaline | Level 20

Gotta say, not very clear from your subject line "Using of Group".

 

Here is a datastep solution, again, not tested.

 

proc sort data = have;
	by circle;
run;

data want;
	set have;
	by circle;
	sum = sum + minutes;
	if last.circle then output;
	retain sum 0;
run;

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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
  • 11 replies
  • 2869 views
  • 4 likes
  • 4 in conversation