
Domains
Agile Management
Master Agile methodologies for efficient and timely project delivery.
View All Agile Management Coursesicon-refresh-cwCertifications
Scrum Alliance
16 Hours
Best Seller
Certified ScrumMaster (CSM) CertificationScrum Alliance
16 Hours
Best Seller
Certified Scrum Product Owner (CSPO) CertificationScaled Agile
16 Hours
Trending
Leading SAFe 6.0 CertificationScrum.org
16 Hours
Professional Scrum Master (PSM) CertificationScaled Agile
16 Hours
SAFe 6.0 Scrum Master (SSM) CertificationAdvanced Certifications
Scaled Agile, Inc.
32 Hours
Recommended
Implementing SAFe 6.0 (SPC) CertificationScaled Agile, Inc.
24 Hours
SAFe 6.0 Release Train Engineer (RTE) CertificationScaled Agile, Inc.
16 Hours
Trending
SAFe® 6.0 Product Owner/Product Manager (POPM)IC Agile
24 Hours
ICP Agile Certified Coaching (ICP-ACC)Scrum.org
16 Hours
Professional Scrum Product Owner I (PSPO I) TrainingMasters
32 Hours
Trending
Agile Management Master's Program32 Hours
Agile Excellence Master's ProgramOn-Demand Courses
Agile and ScrumRoles
Scrum MasterTech Courses and Bootcamps
Full Stack Developer BootcampAccreditation Bodies
Scrum AllianceTop Resources
Scrum TutorialProject Management
Gain expert skills to lead projects to success and timely completion.
View All Project Management Coursesicon-standCertifications
PMI
36 Hours
Best Seller
Project Management Professional (PMP) CertificationAxelos
32 Hours
PRINCE2 Foundation & Practitioner CertificationAxelos
16 Hours
PRINCE2 Foundation CertificationAxelos
16 Hours
PRINCE2 Practitioner CertificationSkills
Change ManagementMasters
Job Oriented
45 Hours
Trending
Project Management Master's ProgramUniversity Programs
45 Hours
Trending
Project Management Master's ProgramOn-Demand Courses
PRINCE2 Practitioner CourseRoles
Project ManagerAccreditation Bodies
PMITop Resources
Theories of MotivationCloud Computing
Learn to harness the cloud to deliver computing resources efficiently.
View All Cloud Computing Coursesicon-cloud-snowingCertifications
AWS
32 Hours
Best Seller
AWS Certified Solutions Architect - AssociateAWS
32 Hours
AWS Cloud Practitioner CertificationAWS
24 Hours
AWS DevOps CertificationMicrosoft
16 Hours
Azure Fundamentals CertificationMicrosoft
24 Hours
Best Seller
Azure Administrator CertificationMicrosoft
45 Hours
Recommended
Azure Data Engineer CertificationMicrosoft
32 Hours
Azure Solution Architect CertificationMicrosoft
40 Hours
Azure DevOps CertificationAWS
24 Hours
Systems Operations on AWS Certification TrainingAWS
24 Hours
Developing on AWSMasters
Job Oriented
48 Hours
New
AWS Cloud Architect Masters ProgramBootcamps
Career Kickstarter
100 Hours
Trending
Cloud Engineer BootcampRoles
Cloud EngineerOn-Demand Courses
AWS Certified Developer Associate - Complete GuideAuthorized Partners of
AWSTop Resources
Scrum TutorialIT Service Management
Understand how to plan, design, and optimize IT services efficiently.
View All DevOps Coursesicon-git-commitCertifications
Axelos
16 Hours
Best Seller
ITIL 4 Foundation CertificationAxelos
16 Hours
ITIL Practitioner CertificationPeopleCert
16 Hours
ISO 14001 Foundation CertificationPeopleCert
16 Hours
ISO 20000 CertificationPeopleCert
24 Hours
ISO 27000 Foundation CertificationAxelos
24 Hours
ITIL 4 Specialist: Create, Deliver and Support TrainingAxelos
24 Hours
ITIL 4 Specialist: Drive Stakeholder Value TrainingAxelos
16 Hours
ITIL 4 Strategist Direct, Plan and Improve TrainingOn-Demand Courses
ITIL 4 Specialist: Create, Deliver and Support ExamTop Resources
ITIL Practice TestData Science
Unlock valuable insights from data with advanced analytics.
View All Data Science Coursesicon-dataBootcamps
Job Oriented
6 Months
Trending
Data Science BootcampJob Oriented
289 Hours
Data Engineer BootcampJob Oriented
6 Months
Data Analyst BootcampJob Oriented
288 Hours
New
AI Engineer BootcampSkills
Data Science with PythonRoles
Data ScientistOn-Demand Courses
Data Analysis Using ExcelTop Resources
Machine Learning TutorialDevOps
Automate and streamline the delivery of products and services.
View All DevOps Coursesicon-terminal-squareCertifications
DevOps Institute
16 Hours
Best Seller
DevOps Foundation CertificationCNCF
32 Hours
New
Certified Kubernetes AdministratorDevops Institute
16 Hours
Devops LeaderSkills
KubernetesRoles
DevOps EngineerOn-Demand Courses
CI/CD with Jenkins XGlobal Accreditations
DevOps InstituteTop Resources
Top DevOps ProjectsBI And Visualization
Understand how to transform data into actionable, measurable insights.
View All BI And Visualization Coursesicon-microscopeBI and Visualization Tools
Certification
24 Hours
Recommended
Tableau CertificationCertification
24 Hours
Data Visualization with Tableau CertificationMicrosoft
24 Hours
Best Seller
Microsoft Power BI CertificationTIBCO
36 Hours
TIBCO Spotfire TrainingCertification
30 Hours
Data Visualization with QlikView CertificationCertification
16 Hours
Sisense BI CertificationOn-Demand Courses
Data Visualization Using Tableau TrainingTop Resources
Python Data Viz LibsCyber Security
Understand how to protect data and systems from threats or disasters.
View All Cyber Security Coursesicon-refresh-cwCertifications
CompTIA
40 Hours
Best Seller
CompTIA Security+EC-Council
40 Hours
Certified Ethical Hacker (CEH v12) CertificationISACA
22 Hours
Certified Information Systems Auditor (CISA) CertificationISACA
40 Hours
Certified Information Security Manager (CISM) Certification(ISC)²
40 Hours
Certified Information Systems Security Professional (CISSP)(ISC)²
40 Hours
Certified Cloud Security Professional (CCSP) Certification16 Hours
Certified Information Privacy Professional - Europe (CIPP-E) CertificationISACA
16 Hours
COBIT5 Foundation16 Hours
Payment Card Industry Security Standards (PCI-DSS) CertificationOn-Demand Courses
CISSPTop Resources
Laptops for IT SecurityWeb Development
Learn to create user-friendly, fast, and dynamic web applications.
View All Web Development Coursesicon-codeBootcamps
Career Kickstarter
6 Months
Best Seller
Full-Stack Developer BootcampJob Oriented
3 Months
Best Seller
UI/UX Design BootcampEnterprise Recommended
6 Months
Java Full Stack Developer BootcampCareer Kickstarter
490+ Hours
Front-End Development BootcampCareer Accelerator
4 Months
Backend Development Bootcamp (Node JS)Skills
ReactOn-Demand Courses
Angular TrainingTop Resources
Top HTML ProjectsBlockchain
Understand how transactions and databases work in blockchain technology.
View All Blockchain Coursesicon-stop-squareBlockchain Certifications
40 Hours
Blockchain Professional Certification32 Hours
Blockchain Solutions Architect Certification32 Hours
Blockchain Security Engineer Certification24 Hours
Blockchain Quality Engineer Certification5+ Hours
Blockchain 101 CertificationOn-Demand Courses
NFT Essentials 101: A Beginner's GuideTop Resources
Blockchain Interview QsProgramming
Learn to code efficiently and design software that solves problems.
View All Programming Coursesicon-codeSkills
Python CertificationInterview Prep
Career Accelerator
3 Months
Software Engineer Interview PrepOn-Demand Courses
Data Structures and Algorithms with JavaScriptTop Resources
Python TutorialBusiness Management
4.5 Rating 60 Questions 30 mins read19 Readers

| Obs | pat_id | first_date_all | all | Linaclotide | Lubiprostone | Plecanatide |
|---|---|---|---|---|---|---|
| 1 | 11121 | 27-Jun-18 | 1 | 1 | 0 | 0 |
| 2 | 11394 | 16-Feb-18 | 1 | 1 | 0 | 0 |
| 3 | 13755 | 13-Mar-19 | 1 | 1 | 0 | 0 |
| 4 | 15461 | 24-Jan-18 | 1 | 0 | 1 | 0 |
| 5 | 13657 | 23-Mar-19 | 1 | 1 | 0 | 0 |
| 6 | 14327 | 19-Mar-19 | 1 | 0 | 0 | 1 |
| 7 | 18999 | 27-Mar-19 | 1 | 1 | 0 | 0 |
| 8 | 19133 | 14-Feb-18 | 1 | 1 | 0 | 0 |
| 9 | 16260 | 19-Apr-18 | 1 | 0 | 1 | 0 |
| 10 | 17194 | 4-Jan-18 | 1 | 1 | 0 | 0 |
ods html file="%sysfunc(pathname(saslib))/pat_details_data.html";
Proc print data = Pat_details; run;
Ods html close;
This will export all the data in html format at the location “saslib” at path mention above.
data a; input name $ 1. marks; cards; a 100 b 200 c 300 ; run; procmeansdata = a summean; run;
Output

One of the most frequently posed SAS interview questions, be ready for it.
In this code, we are giving a data or you can say creating a table using ‘datalines’ but printing the rows which only have status as ‘PT’. We have used loop here to check each row and thus printing the desired results.
| Obs | Name | idno | status | Benefits |
|---|---|---|---|---|
| 1 | Richa | 1002 | FT | Eye/Dental |
| 2 | Simmi | 433 | FT | HMO |
Here in this code we have A (Amount) = 100000 and I (interest) = 0.0925. We need to find Amount and updated interest till five years also the interest increases by 10% every year.
| Obs | A | i | Year |
|---|---|---|---|
| 1 | 109250.00 | 0.10175 | 1 |
| 2 | 120366.19 | 0.11193 | 2 |
| 3 | 133838.17 | 0.12312 | 3 |
| 4 | 150315.99 | 0.13543 | 4 |
| 5 | 170673.18 | 0.14897 | 5 |
This code is only an illustration to create a table declares variables name, age, and dob with formats and taking values using datalines.
input name$ age dob date9.; this statement basically creating variables and giving format to dob as date9.
| Obs | name | Age | Dob |
|---|---|---|---|
| 1 | am | 67 | Oct 13, 1981 |
| 2 | pr | 66 | Apr 10, 1982 |
A staple in SAS logical interview questions, be prepared to answer this one.
| Obs | J | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 13 |
Table Name – Clinical
| OBS | IDs | YOB | Date | diag1 | daig2 | daig3 | daig4 | daig5 |
|---|---|---|---|---|---|---|---|---|
| 1 | 100 | 2-Mar-86 | 2-Mar-18 | D45 | 0 | 0 | D45 | 0 |
| 2 | 100 | 2-Mar-86 | 5-Mar-18 | 0 | D45 | 0 | 0 | D45 |
| 3 | 100 | 2-Mar-86 | 8-Mar-18 | 0 | C50 | 0 | C50 | D45 |
| 4 | 101 | 5-Jan-80 | 8-Jan-18 | 0 | 0 | D45 | D45 | 0 |
| 5 | 101 | 5-Jan-80 | 2-Feb-18 | D45 | 0 | 0 | D45 | 0 |
| 6 | 101 | 5-Jan-80 | 27-Feb-18 | 0 | D45 | 0 | 0 | D45 |
| 7 | 101 | 5-Jan-80 | 24-Mar-18 | D45 | 0 | D45 | 0 | 0 |
| 8 | 101 | 5-Jan-80 | 18-Apr-18 | D45 | 0 | 0 | D45 | 0 |
| 9 | 102 | 4-Jan-85 | 18-Jan-17 | 0 | D45 | 0 | 0 | D45 |
| 10 | 102 | 4-Jan-85 | 25-Jan-18 | D45 | 0 | 0 | D45 | 0 |
| 11 | 102 | 4-Jan-85 | 1-Feb-18 | 0 | D45 | 0 | 0 | D45 |
| 12 | 102 | 4-Jan-85 | 8-Jan-18 | 0 | 0 | D45 | D45 | 0 |
| 13 | 102 | 4-Jan-85 | 15-Feb-19 | 0 | 0 | D45 | D45 | 0 |
| 14 | 103 | 16-Jan-90 | 15-Feb-18 | 0 | D45 | 0 | 0 | D45 |
| 15 | 103 | 16-Jan-90 | 25-Feb-18 | D45 | 0 | 0 | D45 | 0 |
| 16 | 103 | 16-Jan-90 | 7-Mar-18 | 0 | D45 | 0 | 0 | D45 |
| 17 | 103 | 16-Jan-90 | 17-Mar-18 | 0 | 0 | D45 | D45 | 0 |
| 18 | 104 | 25-Jan-92 | 27-Feb-18 | 0 | 0 | D45 | D45 | 0 |
| 19 | 104 | 25-Jan-92 | 24-Mar-18 | 0 | D45 | 0 | 0 | D45 |
| 20 | 104 | 25-Jan-92 | 18-Apr-18 | D45 | 0 | 0 | D45 | 0 |
Suppose we have the above clinical table in the form of SAS Dataset in lib – ‘mylib’. Considering the fact, the following code will give the desired results.
Data Clinical_Analysis;
Set mylib.clinical;
If '01JAN2018'D <= Data <= '31MAR2019'D ;
array diag(*) $diag1 - diag5;
do i=1 to 5;
if diag(i) in ('D45') then f_diag =1;
end;
run;
proc sort data = Clinical_Analysis; by IDs date; run;
Data diag_pat (keep = IDs YOB Date f_diag first_date diag age);
set Clinical_Analysis;
by Ids;
format first_date date9.;
retain diag first_date age;
if first.Ids then do;
diag=0;
first_date =date;
age =0;
end;
age = Year(first_date) - yob;
if f_diag =1 then diag=1;
if last.Ids;
run;
Proc freq data = diag_pat;
title "All required counts";
tables diag age/missing list;
run;output:
Dataset of the code – Table: diag_pat
| OBS | IDs | YOB | Date | f_diag | first_date | diag | Age |
|---|---|---|---|---|---|---|---|
| 1 | 100 | 2-Mar-86 | 8-Mar-18 | 1 | 2-Mar-18 | 1 | 32 |
| 4 | 101 | 5-Jan-80 | 18-Apr-18 | 1 | 8-Jan-18 | 1 | 38 |
| 9 | 102 | 4-Jan-85 | 15-Feb-19 | 1 | 18-Jan-17 | 1 | 34 |
| 14 | 103 | 16-Jan-90 | 17-Mar-18 | 1 | 15-Feb-18 | 1 | 28 |
| 18 | 104 | 25-Jan-92 | 18-Apr-18 | 1 | 27-Feb-18 | 1 | 26 |
This is a frequently asked question in SAS interview questions for experienced.
Format for creating a simple index -
Data <dataset_name> (INDEX = (<variable-name></UNIQUE></NOMISS>))
Creating a single index in one go
Example : data a(index=(seq /unique /nomiss));
Set a;
Run;
Creating multiple indexes in one go
Example: data a(index =(seq /unique /nomiss
State /unique
Year /unique /nomiss)
Set a;
Run;
Format for creating a composite index-
Data <dataset_name> (INDEX = (index-name = <var1 var2 etc></UNIQUE></NOMISS>))
Creating a composite index –
Example – data a(index=(quarter_month = (quarter month) /nomiss)
Set a;
Run;
Note: We can also use the proc’s to create the indexes in the newly generated output datasets.
Additionally, we could also use the proc datasets procedure and proc SQL to generate indexes.
Information From Dataset: A

Information From Dataset: B

The output of the UNION Operator
UNION Operator is used to club the specific variable information from both the tables. Apart from updating the information, it also removes the duplicate data and sorts the combined information.

The output of UNIONALL Operator
UNIONALL Operator works by appending the information from dataset B after the information from dataset A. It doesn’t remove the duplicates or sorts the resultant data.

Note: If the variables are existing in both the tables, but the order of the same is different. SAS throws the below error –
Expect to come across this popular question in SAS logical interview questions.
There are multiple ways to create table in proc SQL:
I. Create Table From Column Definition
We can create a new table without rows by using the CREATE TABLE statement to define the columns and attributes. We can specify a column’s name, type, length, informat, format and label.
procsql; createtable employee( ssn char(9), dob numformat = DATE9.informat = DATE9.label = "Date Of Birth", doh numformat = DATE9.informat = DATE9.label = "Date Of Hire", gender char(1) label = "Gender", estat char(10) label = "Employement Status"); insertinto employee values ("111111111",500,25000,"M","ACTIVE"); quit; procsql; select * from employee; quit;

II. Create Table from a Query Result
Many times, there are situations wherein we already have a structure of the table/view and we are trying to create a mirror table that is referring to columns of the earlier existing table. In such cases, we can use the same CREATE TABLE Statement and place it before the SELECT Statement. An additional benefit of using this approach of creating the table is that the data of the new table is derived on the basis of existing data from the parent table.
procsql; createtable employee1 as select * from employee quit; procsql; select * from employee1; quit;

III. Create Table Like an Existing Table
To create an empty table that has the same columns and attributes as an existing table, we use the LIKE clause while creating the table. One point to note is that an empty table is created using this method and no data is populated inside the table.
procsql;
createtable employee3 like employee;
quit;
A must-know for anyone heading into a SAS interview, this question is frequently asked in tricky SAS interview questions.
Connecting to teradata using pass through
Procsql; Connect to Teradata( USER= “ &user_id.” PASSWORD =” &dbpass” tdpid =rchgrp2 MODE= ‘teardata’); Create table work. Account_details as(Select Account_ Number, Enroll_ Date, Sales, City From Master_ acct_ details Where Account_ Number is not null and Sales gt 40000 ); Disconnect from Teradata; Quit; Connecting to db2 using pass through: Procsql; Connect to db2( DATABASE=CRD_ PROD USER= “ &user_id.” PASSWORD=” &dbpass”); Create table work. Account_details as(Select Account_ Number, Enroll_ Date, Sales, City From Master_ acct_ details Where Account_ Number is not null and Sales gt 40000 ); Disconnect from db2; Quit;
Other way using the library assignments:
Libname AM DB2 DATABASE= CARD_USA Schema=DDKAUTO
USER=”&user_ id.” PASSWORD= “&dbpass”; Procsql;
Create table work. Account_details as(Select Account_ Number, Enroll_ Date, Sales, City From AM.Master_ acct_ details Where Account_ Number is not null and Sales gt 40000);