×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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

(OP)
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.

    

 

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

(OP)
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

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

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
http://sites.google.com/site/sasbuddy/
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close