SlideShare a Scribd company logo
How to concatenating SAS Data Sets - Concatenating Two
or More Data in SAS.
BY
Concatenating Tables
Suppose you have two or more tables that
have the same columns, and you need to
combine all of the rows into a single table. We
call this concatenating tables.
When the columns have the same names, lengths, and types, then
concatenatingtables is simple. You use the DATA step to create a
new table, and simply list the tables that you want to combine in
the SET statement. First, SAS reads all of the rows from the first
table listed in the SET statementand writes them to the new table,
then it reads and writes the rows from the second table, and so on.
In the same DATA step, you can include any other statements that
you need to manipulatethe rows read from all tables.
Use the SET statement
when you want to
combine tables with
similardata in one
output table.
Concatenating Tables with
Matching ColumnsDATA output-table;
SET input-table1 input-
table2 ...;
RUN;
any number
of input tables
In this example, we have the sashelp.classtableand the class_new
table that includes a few new students. I want to include all
students in a new tablenamed class_current.These two tables
have the same columnsand attributes, so we can list both tables in
the SET statement. The new class_currenttable has 22 rows, which
includes the additional threenew students.
Concatenating Tables with
Matching Columnsdata class_current;
set sashelp.class pg2.class_new;
run;
sashelp.class
pg2.class_new
class_current
rows from second table added
after rows from the first table
Activity
• Open p205a01.sas from the activities folder and perform the following
tasks:
1. Notice that the SET statementconcatenates the sashelp.class and
pg2.class_new2 tables. Highlight the DATA step and run the selected
code. What differences do you observe between the first 19 rows and the
last 3 rows?
2. Use the RENAME= data set option to change Student to Name in the
pg2.class_new2 table. Highlight the DATA step and run the selected code.
What warning is issued in the log?
3. Highlight the two PROC CONTENTS steps and run the selected code.
What is the length of Name in sashelp.class and Student in
pg2.class_new2?
Activity – Correct Answer
1. What differences do you observe between
the first 19 rows and the last 3 rows?
Height and Weight
are missing.
Student names are in
separate columns.
Activity – Correct Answer
2. Use the RENAME= data set option to change
Student to Name in the pg2.class_new2
table. Highlight the DATA step and run the
selected code. What warning is issued in the
log?
data class_current;
set sashelp.class
pg2.class_new2(rename=(Student=Name));
run;
WARNING: Multiple lengths were
specified for the variable Name
by input data set(s). This can
cause truncation of data.
Activity – Correct Answer
3. Highlight the two PROC CONTENTS steps and
run the selected code. What is the length of
Name in sashelp.class and Student in
pg2.class_new2?
data class_current;
set sashelp.class
pg2.class_new2(rename=(Student=Name));
run;
Name has a
length of 8.
Student has a
length of 9.
When multiple tables are listed in a SET statement, as the program
is compiled, columnsfrom the first tablewill be added to the PDV
with their corresponding attributes.When SAS reads the second
table in the SET statement,any columns alreadyin the PDV are not
change. In other words, the LENGTH is already set and cannot be
modified.
data class_current;
set sashelp.class
pg2.class_new2(rename=(Student=Name));
run;
Setting Column Attributes
PDV
Name
$ 8
...other columns...
Column lengths are
determined by the first table
listed in the SET statement.
We can solve this problem simply by using the LENGTH statement.
Here we are explicitlydefining the column Name to be character
with a length of 9. Notice that the LENGTH statement comes before
the SET statement so that it will establishthe attributesof Name in
the PDV.
Merging Column Attributes
PDV
Name
$ 9
...other columns...
data class_current;
length Name $ 9;
set sashelp.class
pg2.class_new2(rename=(Student=Name));
run;
Use a LENGTH
statement before
the SET statement
to establishan
appropriatelength.
•Best SAS Training & Placement Institute in Pune
•Online & Classroom training with 100 % Free Placement
Assistance
For Enquiry
9960935965 / 9960935600
Mail us - info@aspireit.net
Visit us : http://aspireit.net/
Follow Us

More Related Content

Similar to SAS Base Programmer Certification Training by Certified Experts

Introduction to MySQL - Part 2
Introduction to MySQL - Part 2Introduction to MySQL - Part 2
Introduction to MySQL - Part 2webhostingguy
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxjainendraKUMAR55
 
Intro to tsql unit 9
Intro to tsql   unit 9Intro to tsql   unit 9
Intro to tsql unit 9Syed Asrarali
 
Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxuzmasulthana3
 
Dbms question
Dbms questionDbms question
Dbms questionRicky Dky
 
An Introduction To Array Functions
An Introduction To Array FunctionsAn Introduction To Array Functions
An Introduction To Array Functionsposterro
 
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageJanuary 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageZurich_R_User_Group
 
Scrollable Updatable
Scrollable UpdatableScrollable Updatable
Scrollable Updatablephanleson
 
Scrollable Updatable
Scrollable UpdatableScrollable Updatable
Scrollable Updatableleminhvuong
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL UsedTheVerse1
 
6.3 my sql queryoptimization_part2
6.3 my sql queryoptimization_part26.3 my sql queryoptimization_part2
6.3 my sql queryoptimization_part2Trần Thanh
 
Essential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfEssential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfJoshCasas1
 
Introduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptIntroduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptdejene3
 

Similar to SAS Base Programmer Certification Training by Certified Experts (20)

Chapter9 more on database and sql
Chapter9 more on database and sqlChapter9 more on database and sql
Chapter9 more on database and sql
 
Msql query
Msql queryMsql query
Msql query
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
Sql
SqlSql
Sql
 
SQL
SQLSQL
SQL
 
Introduction to MySQL - Part 2
Introduction to MySQL - Part 2Introduction to MySQL - Part 2
Introduction to MySQL - Part 2
 
Unit 2 web technologies
Unit 2 web technologiesUnit 2 web technologies
Unit 2 web technologies
 
DBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptxDBMS and SQL(structured query language) .pptx
DBMS and SQL(structured query language) .pptx
 
Intro to tsql unit 9
Intro to tsql   unit 9Intro to tsql   unit 9
Intro to tsql unit 9
 
Day-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptxDay-2 SQL Theory_V1.pptx
Day-2 SQL Theory_V1.pptx
 
Dbms question
Dbms questionDbms question
Dbms question
 
An Introduction To Array Functions
An Introduction To Array FunctionsAn Introduction To Array Functions
An Introduction To Array Functions
 
ADBMS Unit-II c
ADBMS Unit-II cADBMS Unit-II c
ADBMS Unit-II c
 
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table packageJanuary 2016 Meetup: Speeding up (big) data manipulation with data.table package
January 2016 Meetup: Speeding up (big) data manipulation with data.table package
 
Scrollable Updatable
Scrollable UpdatableScrollable Updatable
Scrollable Updatable
 
Scrollable Updatable
Scrollable UpdatableScrollable Updatable
Scrollable Updatable
 
2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used2. DBMS Experiment - Lab 2 Made in SQL Used
2. DBMS Experiment - Lab 2 Made in SQL Used
 
6.3 my sql queryoptimization_part2
6.3 my sql queryoptimization_part26.3 my sql queryoptimization_part2
6.3 my sql queryoptimization_part2
 
Essential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdfEssential Access Exercises week 1-4.pdf
Essential Access Exercises week 1-4.pdf
 
Introduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.pptIntroduction to micro soft Training ms Excel.ppt
Introduction to micro soft Training ms Excel.ppt
 

More from Aspire Techsoft Academy

.NET Course in Pune with 100% Placement Assistance
.NET Course in Pune with 100% Placement Assistance.NET Course in Pune with 100% Placement Assistance
.NET Course in Pune with 100% Placement AssistanceAspire Techsoft Academy
 
Best Java Classes in Pune with 100% Placement Assistance
Best Java Classes in Pune with 100% Placement AssistanceBest Java Classes in Pune with 100% Placement Assistance
Best Java Classes in Pune with 100% Placement AssistanceAspire Techsoft Academy
 
Top 10 Essential Technologies For Every Full Stack .NET Developer!
Top 10 Essential Technologies For Every Full Stack .NET Developer!Top 10 Essential Technologies For Every Full Stack .NET Developer!
Top 10 Essential Technologies For Every Full Stack .NET Developer!Aspire Techsoft Academy
 
How do I Become an SAP SuccessFactors Consultant
How do I Become an SAP SuccessFactors ConsultantHow do I Become an SAP SuccessFactors Consultant
How do I Become an SAP SuccessFactors ConsultantAspire Techsoft Academy
 
SAP HR Training institute in Mumbai with Placement
SAP HR Training institute in Mumbai with PlacementSAP HR Training institute in Mumbai with Placement
SAP HR Training institute in Mumbai with PlacementAspire Techsoft Academy
 
salesforce course in pune - Aspire Techsoft Academy
salesforce course in pune - Aspire Techsoft Academysalesforce course in pune - Aspire Techsoft Academy
salesforce course in pune - Aspire Techsoft AcademyAspire Techsoft Academy
 
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMY
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMYSAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMY
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMYAspire Techsoft Academy
 
Exploring the benefits of SAP S4 HANA.pptx
Exploring the benefits of SAP S4 HANA.pptxExploring the benefits of SAP S4 HANA.pptx
Exploring the benefits of SAP S4 HANA.pptxAspire Techsoft Academy
 
SAS Finance Data Analyst Course in Ahmedabad
SAS Finance Data Analyst Course in AhmedabadSAS Finance Data Analyst Course in Ahmedabad
SAS Finance Data Analyst Course in AhmedabadAspire Techsoft Academy
 
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...Aspire Techsoft Academy
 
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptx
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptxStrategies to Prepare SAS Certification Exam - Aspire Techsoft.pptx
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptxAspire Techsoft Academy
 
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...Aspire Techsoft Academy
 
How do I Start a Career in SAP Success Factors.pptx
How do I Start a Career in SAP Success Factors.pptxHow do I Start a Career in SAP Success Factors.pptx
How do I Start a Career in SAP Success Factors.pptxAspire Techsoft Academy
 
SAP MM Course in Bangalore with Placement – Aspire techsoft
SAP MM Course in Bangalore with Placement – Aspire techsoftSAP MM Course in Bangalore with Placement – Aspire techsoft
SAP MM Course in Bangalore with Placement – Aspire techsoftAspire Techsoft Academy
 
How SAP ERP helps manufacturing industries?
How SAP ERP helps manufacturing industries?How SAP ERP helps manufacturing industries?
How SAP ERP helps manufacturing industries?Aspire Techsoft Academy
 
SAS for Banking and Financial Analytics: Which certification is best for Fina...
SAS for Banking and Financial Analytics: Which certification is best for Fina...SAS for Banking and Financial Analytics: Which certification is best for Fina...
SAS for Banking and Financial Analytics: Which certification is best for Fina...Aspire Techsoft Academy
 
SAP HCM Training in Bangalore – Aspire Techsoft
SAP HCM Training in Bangalore – Aspire TechsoftSAP HCM Training in Bangalore – Aspire Techsoft
SAP HCM Training in Bangalore – Aspire TechsoftAspire Techsoft Academy
 
SAS Base Programming Certification course in Pune - Aspire Techsoft
SAS Base Programming Certification course in Pune - Aspire TechsoftSAS Base Programming Certification course in Pune - Aspire Techsoft
SAS Base Programming Certification course in Pune - Aspire TechsoftAspire Techsoft Academy
 
What is Data analytics? How is data analytics a better career option?
What is Data analytics? How is data analytics a better career option?What is Data analytics? How is data analytics a better career option?
What is Data analytics? How is data analytics a better career option?Aspire Techsoft Academy
 
SAP Training Institute in Pune with placement – Aspire Techsoft
SAP Training Institute in Pune with placement – Aspire TechsoftSAP Training Institute in Pune with placement – Aspire Techsoft
SAP Training Institute in Pune with placement – Aspire TechsoftAspire Techsoft Academy
 

More from Aspire Techsoft Academy (20)

.NET Course in Pune with 100% Placement Assistance
.NET Course in Pune with 100% Placement Assistance.NET Course in Pune with 100% Placement Assistance
.NET Course in Pune with 100% Placement Assistance
 
Best Java Classes in Pune with 100% Placement Assistance
Best Java Classes in Pune with 100% Placement AssistanceBest Java Classes in Pune with 100% Placement Assistance
Best Java Classes in Pune with 100% Placement Assistance
 
Top 10 Essential Technologies For Every Full Stack .NET Developer!
Top 10 Essential Technologies For Every Full Stack .NET Developer!Top 10 Essential Technologies For Every Full Stack .NET Developer!
Top 10 Essential Technologies For Every Full Stack .NET Developer!
 
How do I Become an SAP SuccessFactors Consultant
How do I Become an SAP SuccessFactors ConsultantHow do I Become an SAP SuccessFactors Consultant
How do I Become an SAP SuccessFactors Consultant
 
SAP HR Training institute in Mumbai with Placement
SAP HR Training institute in Mumbai with PlacementSAP HR Training institute in Mumbai with Placement
SAP HR Training institute in Mumbai with Placement
 
salesforce course in pune - Aspire Techsoft Academy
salesforce course in pune - Aspire Techsoft Academysalesforce course in pune - Aspire Techsoft Academy
salesforce course in pune - Aspire Techsoft Academy
 
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMY
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMYSAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMY
SAP S4 HANA IMPLEMENTATION GUIDE - ASPIRE TECHSOFT ACADEMY
 
Exploring the benefits of SAP S4 HANA.pptx
Exploring the benefits of SAP S4 HANA.pptxExploring the benefits of SAP S4 HANA.pptx
Exploring the benefits of SAP S4 HANA.pptx
 
SAS Finance Data Analyst Course in Ahmedabad
SAS Finance Data Analyst Course in AhmedabadSAS Finance Data Analyst Course in Ahmedabad
SAS Finance Data Analyst Course in Ahmedabad
 
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...
SAS Clinical Trials Programmer Certification: Why SAS is the best choice for ...
 
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptx
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptxStrategies to Prepare SAS Certification Exam - Aspire Techsoft.pptx
Strategies to Prepare SAS Certification Exam - Aspire Techsoft.pptx
 
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...
How to Become an SAP ABAP Developer? Career Scope, Salary, Skills, Future Tre...
 
How do I Start a Career in SAP Success Factors.pptx
How do I Start a Career in SAP Success Factors.pptxHow do I Start a Career in SAP Success Factors.pptx
How do I Start a Career in SAP Success Factors.pptx
 
SAP MM Course in Bangalore with Placement – Aspire techsoft
SAP MM Course in Bangalore with Placement – Aspire techsoftSAP MM Course in Bangalore with Placement – Aspire techsoft
SAP MM Course in Bangalore with Placement – Aspire techsoft
 
How SAP ERP helps manufacturing industries?
How SAP ERP helps manufacturing industries?How SAP ERP helps manufacturing industries?
How SAP ERP helps manufacturing industries?
 
SAS for Banking and Financial Analytics: Which certification is best for Fina...
SAS for Banking and Financial Analytics: Which certification is best for Fina...SAS for Banking and Financial Analytics: Which certification is best for Fina...
SAS for Banking and Financial Analytics: Which certification is best for Fina...
 
SAP HCM Training in Bangalore – Aspire Techsoft
SAP HCM Training in Bangalore – Aspire TechsoftSAP HCM Training in Bangalore – Aspire Techsoft
SAP HCM Training in Bangalore – Aspire Techsoft
 
SAS Base Programming Certification course in Pune - Aspire Techsoft
SAS Base Programming Certification course in Pune - Aspire TechsoftSAS Base Programming Certification course in Pune - Aspire Techsoft
SAS Base Programming Certification course in Pune - Aspire Techsoft
 
What is Data analytics? How is data analytics a better career option?
What is Data analytics? How is data analytics a better career option?What is Data analytics? How is data analytics a better career option?
What is Data analytics? How is data analytics a better career option?
 
SAP Training Institute in Pune with placement – Aspire Techsoft
SAP Training Institute in Pune with placement – Aspire TechsoftSAP Training Institute in Pune with placement – Aspire Techsoft
SAP Training Institute in Pune with placement – Aspire Techsoft
 

Recently uploaded

Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchVikramjit Singh
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...AzmatAli747758
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxssuserbdd3e8
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersPedroFerreira53928
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...EugeneSaldivar
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfjoachimlavalley1
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxJisc
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsparmarsneha2
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfkaushalkr1407
 

Recently uploaded (20)

Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
NLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptxNLC-2024-Orientation-for-RO-SDO (1).pptx
NLC-2024-Orientation-for-RO-SDO (1).pptx
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 

SAS Base Programmer Certification Training by Certified Experts

  • 1. How to concatenating SAS Data Sets - Concatenating Two or More Data in SAS. BY
  • 2. Concatenating Tables Suppose you have two or more tables that have the same columns, and you need to combine all of the rows into a single table. We call this concatenating tables.
  • 3. When the columns have the same names, lengths, and types, then concatenatingtables is simple. You use the DATA step to create a new table, and simply list the tables that you want to combine in the SET statement. First, SAS reads all of the rows from the first table listed in the SET statementand writes them to the new table, then it reads and writes the rows from the second table, and so on. In the same DATA step, you can include any other statements that you need to manipulatethe rows read from all tables.
  • 4. Use the SET statement when you want to combine tables with similardata in one output table. Concatenating Tables with Matching ColumnsDATA output-table; SET input-table1 input- table2 ...; RUN; any number of input tables
  • 5. In this example, we have the sashelp.classtableand the class_new table that includes a few new students. I want to include all students in a new tablenamed class_current.These two tables have the same columnsand attributes, so we can list both tables in the SET statement. The new class_currenttable has 22 rows, which includes the additional threenew students.
  • 6. Concatenating Tables with Matching Columnsdata class_current; set sashelp.class pg2.class_new; run; sashelp.class pg2.class_new class_current rows from second table added after rows from the first table
  • 7. Activity • Open p205a01.sas from the activities folder and perform the following tasks: 1. Notice that the SET statementconcatenates the sashelp.class and pg2.class_new2 tables. Highlight the DATA step and run the selected code. What differences do you observe between the first 19 rows and the last 3 rows? 2. Use the RENAME= data set option to change Student to Name in the pg2.class_new2 table. Highlight the DATA step and run the selected code. What warning is issued in the log? 3. Highlight the two PROC CONTENTS steps and run the selected code. What is the length of Name in sashelp.class and Student in pg2.class_new2?
  • 8. Activity – Correct Answer 1. What differences do you observe between the first 19 rows and the last 3 rows? Height and Weight are missing. Student names are in separate columns.
  • 9. Activity – Correct Answer 2. Use the RENAME= data set option to change Student to Name in the pg2.class_new2 table. Highlight the DATA step and run the selected code. What warning is issued in the log? data class_current; set sashelp.class pg2.class_new2(rename=(Student=Name)); run; WARNING: Multiple lengths were specified for the variable Name by input data set(s). This can cause truncation of data.
  • 10. Activity – Correct Answer 3. Highlight the two PROC CONTENTS steps and run the selected code. What is the length of Name in sashelp.class and Student in pg2.class_new2? data class_current; set sashelp.class pg2.class_new2(rename=(Student=Name)); run; Name has a length of 8. Student has a length of 9.
  • 11. When multiple tables are listed in a SET statement, as the program is compiled, columnsfrom the first tablewill be added to the PDV with their corresponding attributes.When SAS reads the second table in the SET statement,any columns alreadyin the PDV are not change. In other words, the LENGTH is already set and cannot be modified.
  • 12. data class_current; set sashelp.class pg2.class_new2(rename=(Student=Name)); run; Setting Column Attributes PDV Name $ 8 ...other columns... Column lengths are determined by the first table listed in the SET statement.
  • 13. We can solve this problem simply by using the LENGTH statement. Here we are explicitlydefining the column Name to be character with a length of 9. Notice that the LENGTH statement comes before the SET statement so that it will establishthe attributesof Name in the PDV.
  • 14. Merging Column Attributes PDV Name $ 9 ...other columns... data class_current; length Name $ 9; set sashelp.class pg2.class_new2(rename=(Student=Name)); run; Use a LENGTH statement before the SET statement to establishan appropriatelength.
  • 15. •Best SAS Training & Placement Institute in Pune •Online & Classroom training with 100 % Free Placement Assistance For Enquiry 9960935965 / 9960935600 Mail us - info@aspireit.net Visit us : http://aspireit.net/ Follow Us