SlideShare a Scribd company logo
1 of 15
Download to read offline
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 Updatableleminhvuong
 
Scrollable Updatable
Scrollable UpdatableScrollable Updatable
Scrollable Updatablephanleson
 
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

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
 
Full Stack Software Testing Institute in Pune- QA Training in Pune
Full Stack Software Testing Institute in Pune-  QA Training in PuneFull Stack Software Testing Institute in Pune-  QA Training in Pune
Full Stack Software Testing Institute in Pune- QA Training in PuneAspire Techsoft Academy
 
Clinical SAS Certification Guide- Aspire Techsoft.pdf
Clinical SAS Certification Guide- Aspire Techsoft.pdfClinical SAS Certification Guide- Aspire Techsoft.pdf
Clinical SAS Certification Guide- Aspire Techsoft.pdfAspire Techsoft Academy
 
Best SAP FI Training in Pune | SAP FICO Course PUNE
Best SAP FI Training in Pune | SAP FICO Course PUNEBest SAP FI Training in Pune | SAP FICO Course PUNE
Best SAP FI Training in Pune | SAP FICO Course PUNEAspire Techsoft Academy
 

More from Aspire Techsoft Academy (20)

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
 
Full Stack Software Testing Institute in Pune- QA Training in Pune
Full Stack Software Testing Institute in Pune-  QA Training in PuneFull Stack Software Testing Institute in Pune-  QA Training in Pune
Full Stack Software Testing Institute in Pune- QA Training in Pune
 
Clinical SAS Certification Guide- Aspire Techsoft.pdf
Clinical SAS Certification Guide- Aspire Techsoft.pdfClinical SAS Certification Guide- Aspire Techsoft.pdf
Clinical SAS Certification Guide- Aspire Techsoft.pdf
 
Best SAP FI Training in Pune | SAP FICO Course PUNE
Best SAP FI Training in Pune | SAP FICO Course PUNEBest SAP FI Training in Pune | SAP FICO Course PUNE
Best SAP FI Training in Pune | SAP FICO Course PUNE
 

Recently uploaded

Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxdhanalakshmis0310
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 

Recently uploaded (20)

Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 

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