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;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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