SAS Support

How to handle multiple data sets?

  • Add more observations to an existing data and the new observations follow the same data structure as the old one è append
  • Add more variables to an existing data and the new variables refer to the same subjects as in the old data è merge
  • Sometimes we may need to change data structure to fit in append or merge ….

Merge two data sets

Data set 1:

proj3rawdata3:   year state totalpop … fracuninsured   newgrp  popgrp

                             2009  MA   6420947 …  0.0548        1          high        

Date set 2:

summary1:             newgrp    popgrp  avguninsured avgfracuninsured

                                     1          high        7500000          0.073

 

proc sort data=proj3rawdata3;

  by newgrp popgrp;

  run;

proc sort data=summary1;

  by newgrp popgrp;

  run;

data merged;

  merge proj3rawdata3 (in=one) summary1 (in=two);

  by newgrp popgrp;

  if one=1 & two=1;

  run;

Append two data sets

data appended;

  set proj3rawdata3 summary1;

  run;

proc print data=appended;

  run;

Selected Books on SAS

Administrative Healthcare Data: A Guide to Its Origin, Content, and Application Using SAS®  

Craig Dickstein, Renu Gehring

Epub ISBN# 978-1-62959-381-4

Mobi ISBN# 978-1-62959-382-1

PDF ISBN# 978-1-62959-380-7

Hardcopy ISBN# 978-1-61290-886-1

Pages 250

http://www.sas.com/store/prodBK_66981_en.html

 

The Little SAS® Book: A Primer, Fifth Edition

Lora D. Delwiche, Susan J. Slaughter

Epub ISBN# 978-1-61290-400-9

Mobi ISBN# 978-1-61290-945-5

PDF ISBN# 978-1-62959-013-4

Hardcopy ISBN# 978-1-61290-343-9

Pages 376

Learning SAS® by Example: A Programmer's Guide

Ron Cody

Epub ISBN# 978-1-59994-426-5

Mobi ISBN# 978-1-61290-946-2

PDF ISBN# 978-1-62959-014-1

Hardcopy ISBN# 978-1-59994-165-3

Pages 664

 

Step-by-Step Programming with Base SAS® 9.4

Publisher: SAS Institute

Copyright Date: July 2013

The PDF file of this book can be found at:

http://support.sas.com/documentation/cdl/en/basess/64003/HTML/default/viewer.htm#titlepage.htm

Longitudinal Data and SAS®: A Programmer's Guide

Ron Cody

Epub ISBN# 978-1-62959-249-7

Mobi ISBN# 978-1-62959-248-0

PDF ISBN# 978-1-62959-247-3

Hardcopy ISBN# 978-1-58025-924-8

Pages 208

http://www.sas.com/store/books/categories/usage-and-reference/longitudinal-data-and-sas-a-programmer-s-guide/prodBK_58176_en.html

 
Marriott Library Eccles Library Quinney Law Library