Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Base SAS 9.1 Sum One Column of Observations (New To SAS) 1

Status
Not open for further replies.

Christineeve

Programmer
Feb 12, 2005
104
US
Hi,
I'm new to SAS coming over from the Visual Basic/.Net side of the house here. I'm not SAS programmer, yet, I'm currently a SAS Cut-n-Paster. I have some SAS PDFs and they cover SUM and MEANS but using these handouts, I can't get my answer. Your help would be appreciated.

I am trying to take two datasets that I've created and sum the obeservations. For example:
Two Data Sets A and A_1, both have one observation of a count.
Count
1000
4000

I want to create a new data set with the sum. Thus,
Table C
5000

Here is my "code".
Code:
libname rwork slibref=work server=xxsas;
DM 'Clear log'; 

rsubmit;
proc sql;  
	create table DBI_b_Union_PaP as 
	select * 
	from Dbi_b_wf as Pap	
	
	UNION
	
	select * 
	from Dbi_b_d001p as Pap	
	group by 1
		;
quit;
endrsubmit;


rsubmit;
Proc SQL;
  create table sDBI_b_Union_PaP as 
  select count
  from Dbi_b_union_pap
  group by count;
quit;
endrsubmit;

Any help would be appreciated.



 
I found the answer on another post, but couldn't get it to work. After working with it for a bit, I did get it to work.

Code:
select *
from Dbi_b_d001p as Pap	
group by 1
 
Your actual Proc SQL code is confusing me a bit.
But it can be eaisly done with BASE SAS code;

data temp;
set a a_1;
run;

rsubmit;
Proc SQL;
create table sDBI_b_Union_PaP as
select sum(count)
from temp;
quit;
endrsubmit;





sasbuddy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top