尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Base SAS Interview Questions Answers
Leave a CommentPosted by sasinterviewsquestion on March 11, 2012
NOTE: The purpose of this post is to povide a learning for those preparing for SAS interview or global
certification. Thus, all answers for the below mentioned questions are correct (for your
learning). Questions are either asked directly or indirectly in SAS Interviews(2012).
Question: What is the function of output statement?
Answer: To override the default way in which the DATA step writes observations to output, you can use
anOUTPUT statement in the DATA step. Placing an explicit OUTPUT statement in a DATA step overrides the
automatic output, so that observations are added to a data set only when the explicit OUTPUT statement is
executed.
Question: What is the function of Stop statement?
Answer: Stop statement causes SAS to stop processing the current data step immediately and resume
processing statement after the end of current data step.
Question : What is the difference between using drop= data set option in data statement and set
statement?
Answer: If you don‟t want to process certain variables and you do not want them to appear in the new data
set, then specify drop= data set option in the set statement.
Whereas If want to process certain variables and do not want them to appear in the new data set, then specify
drop= data set option in the data statement.
Question: Given an unsorted dataset, how to read the last observation to a new data set?
Answer: using end= data set option.
For example:
data work.calculus;
set work.comp end=last;
If last;
run;
Where Calculus is a new data set to be created and Comp is the existing data set
last is the temporary variable (initialized to 0) which is set to 1 when the set statement reads the last
observation.
Question : What is the difference between reading the data from external file and reading the data
from existing data set?
Answer: The main difference is that while reading an existing data set with the SET statement, SAS retains the
values of the variables from one observation to the next.
Question: What is the difference between SAS function and procedures?
Answer: Functions expects argument value to be supplied across an observation in a SAS data set and
procedure expects one variable value per observation.
For example:
data average ;
set temp ;
avgtemp = mean( of T1 – T24 ) ;
run ;
Here arguments of mean function are taken across an observation.
proc sort ;
by month ;
run ;
proc means ;
by month ;
var avgtemp ;
run ;
Proc means is used to calculate average temperature by month (taking one variable value across an
observation).
Question: Differnce b/w sum function and using “+” operator?
Answer: SUM function returns the sum of non-missing arguments whereas “+” operator returns a missing
value if any of the arguments are missing.
Example:
data mydata;
input x y z;
cards;
33 3 3
24 3 4
24 3 4
. 3 2
23 . 3
54 4 .
35 4 2
;
run;
data mydata2;
set mydata;
a=sum(x,y,z);
p=x+y+z;
run;
In the output, value of p is missing for 3rd, 4th and 5th observation as :
a p
39 39
31 31
31 31
5 .
26 .
58 .
41 41
Question: What would be the result if all the arguments in SUM function are missing?
Answer: a missing value
Question: What would be the denominator value used by the mean function if two out of seven arguments
are missing?
Answer: five
Question: Give an example where SAS fails to convert character value to numeric value automatically?
Answer: Suppose value of a variable PayRate begins with a dollar sign ($). When SAS tries to automatically
convert the values of PayRate to numeric values, the dollar sign blocks the process. The values cannot be
converted to numeric values.
Therefore, it is always best to include INPUT and PUT functions in your programs when conversions occur.
Question: What would be the resulting numeric value (generated by automatic char to numeric conversion) of
a below mentioned character value when used in arithmetic calculation?
1,735.00
Answer: a missing value
Question: What would be the resulting numeric value (generated by automatic char to numeric conversion) of
a below mentioned character value when used in arithmetic calculation?
1735.00
Answer: 1735
Question: Which SAS statement does not perform automatic conversions in comparisons?
Answer: where statement
Question: Briefly explain Input and Put function?
Answer: Input function – Character to numeric conversion- Input(source,informat)
put function – Numeric to character conversion- put(source,format)
Question: What would be the result of following SAS function(given that 31 Dec, 2000 is Sunday)?
Weeks = intck („week‟,‟31 dec 2000′d,‟01jan2001′d);
Years = intck („year‟,‟31 dec 2000′d,‟01jan2001′d);
Months = intck („month‟,‟31 dec 2000′d,‟01jan2001′d);
Answer: Weeks=0, Years=1,Months=1
Question: What are the parameters of Scan function?
Answer: scan(argument,n,delimiters)
argument specifies the character variable or expression to scan
n specifies which word to read
delimiters are special characters that must be enclosed in single quotation marks
Question: Suppose the variable address stores the following expression:
209 RADCLIFFE ROAD, CENTER CITY, NY, 92716
What would be the result returned by the scan function in the following cases?
a=scan(address,3);
b=scan(address,3,‟,');
Answer: a=Road; b=NY
Question: What is the length assigned to the target variable by the scan function?
Answer: 200
Question: Name few SAS functions?
Answer: Scan, Substr, trim, Catx, Index, tranwrd, find, Sum.
Question: What is the function of tranwrd function?
Answer: TRANWRD function replaces or removes all occurrences of a pattern of characters within a
character string.
Question: Consider the following SAS Program
data finance.earnings;
Amount=1000;
Rate=.075/12;
do month=1 to 12;
Earned+(amount+earned)*(rate);
end;
run;
What would be the value of month at the end of data step execution and how many observations would be
there?
Answer: Value of month would be 13
No. of observations would be 1
Question: Consider the following SAS Program
data finance;
Amount=1000;
Rate=.075/12;
do month=1 to 12;
Earned+(amount+earned)*(rate);
output;
end;
run;
How many observations would be there at the end of data step execution?
Answer: 12
Question: How do you use the do loop if you don‟t know how many times should you execute the do loop?
Answer: we can use do until or do while to specify the condition.
Question: What is the difference between do while and do until?
Answer: An important difference between the DO UNTIL and DO WHILE statements is that the DO WHILE
expression is evaluated at the top of the DO loop. If the expression is false the first time it is evaluated, then
the DO loop never executes. Whereas DO UNTIL executes at least once.
Question: How do you specify number of iterations and specific condition within a single do loop?
Answer:
data work;
do i=1 to 20 until(Sum>=20000);
Year+1;
Sum+2000;
Sum+Sum*.10;
end;
run;
This iterative DO statement enables you to execute the DO loop until Sum is greater than or equal to 20000 or
until the DO loop executes 10 times, whichever occurs first.
Question: How many data types are there in SAS?
Answer: Character, Numeric
Question: If a variable contains only numbers, can it be character data type? Also give example
Answer: Yes, it depends on how you use the variable
Example: ID, Zip are numeric digits and can be character data type.
Question: If a variable contains letters or special characters, can it be numeric data type?
Answer: No, it must be character data type.
Question; What can be the size of largest dataset in SAS?
Answer: The number of observations is limited only by computer‟s capacity to handle and store them.
Prior to SAS 9.1, SAS data sets could contain up to 32,767 variables. In SAS 9.1, the maximum number of
variables in a SAS data set is limited by the resources available on your computer.
Question: Give some example where PROC REPORT’s defaults are different than PROC PRINT’s
defaults?
Answer:
No Record Numbers in Proc Report
Labels (not var names) used as headers in Proc Report
REPORT needs NOWINDOWS option
Question: Give some example where PROC REPORT’s defaults are same as PROC PRINT’s defaults?
Answer:
Variables/Columns in position order.
Rows ordered as they appear in data set.
Question: Highlight the major difference between below two programs:
a.
data mydat;
input ID Age;
cards;
2 23
4 45
3 56
9 43
;
run;
proc report data = mydat nowd;
column ID Age;
run;
b.
data mydat1;
input grade $ ID Age;
cards;
A 2 23
B 4 45
C 3 56
D 9 43
;
run;
proc report data = mydat1 nowd;
column Grade ID Age;
run;
Answer: When all the variables in the input file are numeric, PROC REPORT does a sum as a default.Thus first
program generates one record in the list report whereas second generates four records.
Question: In the above program, how will you avoid having the sum of numeric variables?
Answer: To avoid having the sum of numeric variables, one or more of the input variables must be defined
as DISPLAY.
Thus we have to use :
proc report data = mydat nowd;
column ID Age;
define ID/display;
run;
Question: What is the difference between Order and Group variable in proc report?
Answer:
If the variable is used as group variable, rows that have the same values are collapsed.
Group variables produce list report whereas order variable produces summary report.
Question: Give some ways by which you can define the variables to produce the summary report (using proc
report)?
Answer: All of the variables in a summary report must be defined as group, analysis, across, or
Computed variables.
Questions: What are the default statistics for means procedure?
Answer: n-count, mean, standard deviation, minimum, and maximum
Question: How to limit decimal places for variable using PROC MEANS?
Answer: By using MAXDEC= option
Question: What is the difference between CLASS statement and BY statement in proc means?
Answer:
Unlike CLASS processing, BY processing requires that your data already be sorted or
indexed in the order of the BY variables.
BY group results have a layout that is different from the layout of CLASS group results.
Question: What is the difference between PROC MEANS and PROC Summary?
Answer: The difference between the two procedures is that PROC MEANS produces a report by default. By
contrast, to produce a report in PROC SUMMARY, you must include a PRINT option in the PROC SUMMARY
statement.
Question: How to specify variables to be processed by the FREQ procedure?
Answer: By using TABLES Statement.
Question: Describe CROSSLIST option in TABLES statement?
Answer: Adding the CROSSLIST option to TABLES statement displays crosstabulation tables in ODS column
format.
Question: How to create list output for crosstabulations in proc freq?
Answer: To generate list output for crosstabulations, add a slash (/) and the LIST option to the TABLES
statement in your PROC FREQ step.
TABLES variable-1*variable-2 <* … variable-n> / LIST;
Question: Proc Means work for ________ variable and Proc FREQ Work for ______ variable?
Answer: Numeric, Categorical
Question: How can you combine two datasets based on the relative position of rows in each data set; that
is, the first observation in one data set is joined with the first observation in the other, and so on?
Answer: One to One reading
Question: data concat;
set a b;
run;
format of variable Revenue in dataset a is dollar10.2 and format of variable Revenue in dataset b is dollar12.2
What would be the format of Revenue in resulting dataset (concat)?
Answer: dollar10.2
Question: If you have two datasets you want to combine them in the manner such that observations in each
BY group in each data set in the SET statement are read sequentially, in the order in which the data sets and
BY variables are listed then which method of combining datasets will work for this?
Answer: Interleaving
Question: While match merging two data sets, you cannot use the __________option with indexed data sets
because indexes are always stored in ascending order.
Answer: Descending
Question: I have a dataset concat having variable a b & c. How to rename a b to e & f?
Answer: data concat(rename=(a=e b=f));
set concat;
run;
Question : What is the difference between One to One Merge and Match Merge? Give example also..
Answer: If both data sets in the merge statement are sorted by id(as shown below) and each observation in
one data set has a corresponding observation in the other data set, a one-to-one merge is suitable.
data mydata1;
input id class $;
cards;
1 Sa
2 Sd
3 Rd
4 Uj
;
data mydata2;
input id class1 $;
cards;
1 Sac
2 Sdf
3 Rdd
4 Lks
;
data mymerge;
merge mydata1 mydata2;
run;
If the observations do not match, then match merging is suitable
data mydata1;
input id class $;
cards;
1 Sa
2 Sd
2 Sp
3 Rd
4 Uj
;
data mydata2;
input id class1 $;
cards;
1 Sac
2 Sdf
3 Rdd
3 Lks
5 Ujf
;
data mymerge;
merge mydata1 mydata2;
by id
run;

More Related Content

What's hot

SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
Gnana Murthy A
 
Base SAS Exam Questions
Base SAS Exam QuestionsBase SAS Exam Questions
Base SAS Exam Questions
guestc45097
 
CDISC SDTM Domain Presentation
CDISC SDTM Domain PresentationCDISC SDTM Domain Presentation
CDISC SDTM Domain Presentation
Ankur Sharma
 
Arrays in SAS
Arrays in SASArrays in SAS
Arrays in SAS
guest2160992
 
SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)
SWAROOP KUMAR K
 
Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1
ray4hz
 
SAS Functions
SAS FunctionsSAS Functions
SAS Functions
guest2160992
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
Venkata Reddy Konasani
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
halasti
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Language
guest2160992
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
guest2160992
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper
Jimmy Rana
 
Finding everything about findings about (fa)
Finding everything about findings about (fa)Finding everything about findings about (fa)
Finding everything about findings about (fa)
Ram Gali
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
Ravi Mandal, MBA
 
How to build ADaM BDS dataset from mock up table
How to build ADaM BDS dataset from mock up tableHow to build ADaM BDS dataset from mock up table
How to build ADaM BDS dataset from mock up table
Kevin Lee
 
Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3
Mark Tabladillo
 
ADaM - Where Do I Start?
ADaM - Where Do I Start?ADaM - Where Do I Start?
ADaM - Where Do I Start?
Dr.Sangram Parbhane
 
CDISC SDTM and ADaM for survival data
CDISC SDTM and ADaM for survival dataCDISC SDTM and ADaM for survival data
CDISC SDTM and ADaM for survival data
Angelo Tinazzi
 
A complex ADaM dataset - three different ways to create one
A complex ADaM dataset - three different ways to create oneA complex ADaM dataset - three different ways to create one
A complex ADaM dataset - three different ways to create one
Kevin Lee
 
ADaM
ADaMADaM

What's hot (20)

SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
 
Base SAS Exam Questions
Base SAS Exam QuestionsBase SAS Exam Questions
Base SAS Exam Questions
 
CDISC SDTM Domain Presentation
CDISC SDTM Domain PresentationCDISC SDTM Domain Presentation
CDISC SDTM Domain Presentation
 
Arrays in SAS
Arrays in SASArrays in SAS
Arrays in SAS
 
SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)SDTM (Study Data Tabulation Model)
SDTM (Study Data Tabulation Model)
 
Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1Cdisc sdtm implementation_process _v1
Cdisc sdtm implementation_process _v1
 
SAS Functions
SAS FunctionsSAS Functions
SAS Functions
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
 
Basics Of SAS Programming Language
Basics Of SAS Programming LanguageBasics Of SAS Programming Language
Basics Of SAS Programming Language
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper
 
Finding everything about findings about (fa)
Finding everything about findings about (fa)Finding everything about findings about (fa)
Finding everything about findings about (fa)
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
 
How to build ADaM BDS dataset from mock up table
How to build ADaM BDS dataset from mock up tableHow to build ADaM BDS dataset from mock up table
How to build ADaM BDS dataset from mock up table
 
Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3
 
ADaM - Where Do I Start?
ADaM - Where Do I Start?ADaM - Where Do I Start?
ADaM - Where Do I Start?
 
CDISC SDTM and ADaM for survival data
CDISC SDTM and ADaM for survival dataCDISC SDTM and ADaM for survival data
CDISC SDTM and ADaM for survival data
 
A complex ADaM dataset - three different ways to create one
A complex ADaM dataset - three different ways to create oneA complex ADaM dataset - three different ways to create one
A complex ADaM dataset - three different ways to create one
 
ADaM
ADaMADaM
ADaM
 

Viewers also liked

64 interview questions
64 interview questions64 interview questions
64 interview questions
Tarikul Alam
 
Sas demo
Sas demoSas demo
SAS Presentation
SAS PresentationSAS Presentation
SAS Presentation
Kali Howard
 
Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS Programming
SASTechies
 
Efficacy of drugs - SAS Case Study
Efficacy of drugs - SAS Case StudyEfficacy of drugs - SAS Case Study
Efficacy of drugs - SAS Case Study
Krishna Bollojula
 
Five Steps to Being a Top DBA Learning Automation in SQL Server
Five Steps to Being a Top DBA Learning Automation in SQL ServerFive Steps to Being a Top DBA Learning Automation in SQL Server
Five Steps to Being a Top DBA Learning Automation in SQL Server
Embarcadero Technologies
 
BASE SAS
BASE SASBASE SAS
scorereport
scorereportscorereport
SAS BA
SAS BASAS BA
Vivek_Base_SAS_Scorecard
Vivek_Base_SAS_ScorecardVivek_Base_SAS_Scorecard
Vivek_Base_SAS_Scorecard
Vivek Shelke
 
Currency Vol
Currency VolCurrency Vol
Currency Vol
pkguess34
 
Advance SAS certificate
Advance SAS certificateAdvance SAS certificate
Advance SAS certificate
Pala Sravan
 
Civil services
Civil servicesCivil services
Civil services
Srinivas Ssv
 
15 New Technologies in 50 Minutes
15 New Technologies in 50 Minutes15 New Technologies in 50 Minutes
15 New Technologies in 50 Minutes
askacpl
 
Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis System
Sushil kasar
 
online room booking system
online room booking systemonline room booking system
online room booking system
manuchinna
 
Fraser Tough PhD thesis_FINAL
Fraser Tough PhD thesis_FINALFraser Tough PhD thesis_FINAL
Fraser Tough PhD thesis_FINAL
Fraser Tough
 

Viewers also liked (17)

64 interview questions
64 interview questions64 interview questions
64 interview questions
 
Sas demo
Sas demoSas demo
Sas demo
 
SAS Presentation
SAS PresentationSAS Presentation
SAS Presentation
 
Learn SAS Programming
Learn SAS ProgrammingLearn SAS Programming
Learn SAS Programming
 
Efficacy of drugs - SAS Case Study
Efficacy of drugs - SAS Case StudyEfficacy of drugs - SAS Case Study
Efficacy of drugs - SAS Case Study
 
Five Steps to Being a Top DBA Learning Automation in SQL Server
Five Steps to Being a Top DBA Learning Automation in SQL ServerFive Steps to Being a Top DBA Learning Automation in SQL Server
Five Steps to Being a Top DBA Learning Automation in SQL Server
 
BASE SAS
BASE SASBASE SAS
BASE SAS
 
scorereport
scorereportscorereport
scorereport
 
SAS BA
SAS BASAS BA
SAS BA
 
Vivek_Base_SAS_Scorecard
Vivek_Base_SAS_ScorecardVivek_Base_SAS_Scorecard
Vivek_Base_SAS_Scorecard
 
Currency Vol
Currency VolCurrency Vol
Currency Vol
 
Advance SAS certificate
Advance SAS certificateAdvance SAS certificate
Advance SAS certificate
 
Civil services
Civil servicesCivil services
Civil services
 
15 New Technologies in 50 Minutes
15 New Technologies in 50 Minutes15 New Technologies in 50 Minutes
15 New Technologies in 50 Minutes
 
Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis System
 
online room booking system
online room booking systemonline room booking system
online room booking system
 
Fraser Tough PhD thesis_FINAL
Fraser Tough PhD thesis_FINALFraser Tough PhD thesis_FINAL
Fraser Tough PhD thesis_FINAL
 

Similar to Base sas interview questions

Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
todd331
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
Abdullah Al-hazmy
 
Data stage interview questions and answers|DataStage FAQS
Data stage interview questions and answers|DataStage FAQSData stage interview questions and answers|DataStage FAQS
Data stage interview questions and answers|DataStage FAQS
BigClasses.com
 
Ab ap faq
Ab ap faqAb ap faq
Ab ap faq
alok khobragade
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
Mard Geer
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
SourabhPal46
 
Dbms question
Dbms questionDbms question
Dbms question
Ricky Dky
 
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionStar Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Franck Pachot
 
Feature Engineering in NLP.pdf
Feature Engineering in NLP.pdfFeature Engineering in NLP.pdf
Feature Engineering in NLP.pdf
bilaje4244prolugcom
 
Big Data Transformation Powered By Apache Spark.pptx
Big Data Transformation Powered By Apache Spark.pptxBig Data Transformation Powered By Apache Spark.pptx
Big Data Transformation Powered By Apache Spark.pptx
Knoldus Inc.
 
Big Data Transformations Powered By Spark
Big Data Transformations Powered By SparkBig Data Transformations Powered By Spark
Big Data Transformations Powered By Spark
Knoldus Inc.
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Serban Tanasa
 
Database Modeling presentation
Database Modeling  presentationDatabase Modeling  presentation
Database Modeling presentation
Bhavishya Tyagi
 
Informatica data warehousing_job_interview_preparation_guide
Informatica data warehousing_job_interview_preparation_guideInformatica data warehousing_job_interview_preparation_guide
Informatica data warehousing_job_interview_preparation_guide
Dhanasekar T
 
5 structured programming
5 structured programming 5 structured programming
5 structured programming
hccit
 
New features of SQL 2012
New features of SQL 2012New features of SQL 2012
New features of SQL 2012
Mindfire Solutions
 
Quick start learn dax basics in 30 minutes
Quick start   learn dax basics in 30 minutesQuick start   learn dax basics in 30 minutes
Quick start learn dax basics in 30 minutes
Компания Робот Икс
 
Bt0065
Bt0065Bt0065
Bt0065
Simpaly Jha
 
B T0065
B T0065B T0065
B T0065
Simpaly Jha
 
C++.pptx
C++.pptxC++.pptx
C++.pptx
Sabi995708
 

Similar to Base sas interview questions (20)

Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
 
Data Structures- Part1 overview and review
Data Structures- Part1 overview and reviewData Structures- Part1 overview and review
Data Structures- Part1 overview and review
 
Data stage interview questions and answers|DataStage FAQS
Data stage interview questions and answers|DataStage FAQSData stage interview questions and answers|DataStage FAQS
Data stage interview questions and answers|DataStage FAQS
 
Ab ap faq
Ab ap faqAb ap faq
Ab ap faq
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 
Dbms question
Dbms questionDbms question
Dbms question
 
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory optionStar Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
Star Transformation, 12c Adaptive Bitmap Pruning and In-Memory option
 
Feature Engineering in NLP.pdf
Feature Engineering in NLP.pdfFeature Engineering in NLP.pdf
Feature Engineering in NLP.pdf
 
Big Data Transformation Powered By Apache Spark.pptx
Big Data Transformation Powered By Apache Spark.pptxBig Data Transformation Powered By Apache Spark.pptx
Big Data Transformation Powered By Apache Spark.pptx
 
Big Data Transformations Powered By Spark
Big Data Transformations Powered By SparkBig Data Transformations Powered By Spark
Big Data Transformations Powered By Spark
 
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
Get up to Speed (Quick Guide to data.table in R and Pentaho PDI)
 
Database Modeling presentation
Database Modeling  presentationDatabase Modeling  presentation
Database Modeling presentation
 
Informatica data warehousing_job_interview_preparation_guide
Informatica data warehousing_job_interview_preparation_guideInformatica data warehousing_job_interview_preparation_guide
Informatica data warehousing_job_interview_preparation_guide
 
5 structured programming
5 structured programming 5 structured programming
5 structured programming
 
New features of SQL 2012
New features of SQL 2012New features of SQL 2012
New features of SQL 2012
 
Quick start learn dax basics in 30 minutes
Quick start   learn dax basics in 30 minutesQuick start   learn dax basics in 30 minutes
Quick start learn dax basics in 30 minutes
 
Bt0065
Bt0065Bt0065
Bt0065
 
B T0065
B T0065B T0065
B T0065
 
C++.pptx
C++.pptxC++.pptx
C++.pptx
 

More from Dr P Deepak

Mal3
Mal3Mal3
Malabsorption
MalabsorptionMalabsorption
Malabsorption
Dr P Deepak
 
Differentiating trigeminal neuropathy from trigeminal neuralgia
Differentiating trigeminal neuropathy from trigeminal neuralgiaDifferentiating trigeminal neuropathy from trigeminal neuralgia
Differentiating trigeminal neuropathy from trigeminal neuralgia
Dr P Deepak
 
Beck depression-inventory-real-time-report
Beck depression-inventory-real-time-reportBeck depression-inventory-real-time-report
Beck depression-inventory-real-time-report
Dr P Deepak
 
Audit
AuditAudit
Antihistamines and-asthma-patients-2002
Antihistamines and-asthma-patients-2002Antihistamines and-asthma-patients-2002
Antihistamines and-asthma-patients-2002
Dr P Deepak
 
Corticosteriods
CorticosteriodsCorticosteriods
Corticosteriods
Dr P Deepak
 
Review anti-cancer agents in medicinal chemistry, 2013
Review anti-cancer agents in medicinal chemistry, 2013Review anti-cancer agents in medicinal chemistry, 2013
Review anti-cancer agents in medicinal chemistry, 2013
Dr P Deepak
 
Ctg underlying pathophysiology
Ctg underlying pathophysiologyCtg underlying pathophysiology
Ctg underlying pathophysiology
Dr P Deepak
 
Ichdii cranial
Ichdii cranialIchdii cranial
Ichdii cranial
Dr P Deepak
 
Occipitalneuralgia
OccipitalneuralgiaOccipitalneuralgia
Occipitalneuralgia
Dr P Deepak
 
6122 htn lp_01.12.06
6122 htn lp_01.12.066122 htn lp_01.12.06
6122 htn lp_01.12.06
Dr P Deepak
 
En atbantibiotics
En atbantibioticsEn atbantibiotics
En atbantibiotics
Dr P Deepak
 
Hypertension guidelines2008to2010update
Hypertension guidelines2008to2010updateHypertension guidelines2008to2010update
Hypertension guidelines2008to2010update
Dr P Deepak
 
Htn pharmacotherapy
Htn pharmacotherapyHtn pharmacotherapy
Htn pharmacotherapy
Dr P Deepak
 
Malaria treatment protocol
Malaria treatment protocolMalaria treatment protocol
Malaria treatment protocol
Dr P Deepak
 
Studying drug induced-disease
Studying drug induced-diseaseStudying drug induced-disease
Studying drug induced-disease
Dr P Deepak
 
Strom11206
Strom11206Strom11206
Strom11206
Dr P Deepak
 
Ad hoc reporting
Ad hoc reportingAd hoc reporting
Ad hoc reporting
Dr P Deepak
 
2010 cv pharm slp
2010 cv pharm slp2010 cv pharm slp
2010 cv pharm slp
Dr P Deepak
 

More from Dr P Deepak (20)

Mal3
Mal3Mal3
Mal3
 
Malabsorption
MalabsorptionMalabsorption
Malabsorption
 
Differentiating trigeminal neuropathy from trigeminal neuralgia
Differentiating trigeminal neuropathy from trigeminal neuralgiaDifferentiating trigeminal neuropathy from trigeminal neuralgia
Differentiating trigeminal neuropathy from trigeminal neuralgia
 
Beck depression-inventory-real-time-report
Beck depression-inventory-real-time-reportBeck depression-inventory-real-time-report
Beck depression-inventory-real-time-report
 
Audit
AuditAudit
Audit
 
Antihistamines and-asthma-patients-2002
Antihistamines and-asthma-patients-2002Antihistamines and-asthma-patients-2002
Antihistamines and-asthma-patients-2002
 
Corticosteriods
CorticosteriodsCorticosteriods
Corticosteriods
 
Review anti-cancer agents in medicinal chemistry, 2013
Review anti-cancer agents in medicinal chemistry, 2013Review anti-cancer agents in medicinal chemistry, 2013
Review anti-cancer agents in medicinal chemistry, 2013
 
Ctg underlying pathophysiology
Ctg underlying pathophysiologyCtg underlying pathophysiology
Ctg underlying pathophysiology
 
Ichdii cranial
Ichdii cranialIchdii cranial
Ichdii cranial
 
Occipitalneuralgia
OccipitalneuralgiaOccipitalneuralgia
Occipitalneuralgia
 
6122 htn lp_01.12.06
6122 htn lp_01.12.066122 htn lp_01.12.06
6122 htn lp_01.12.06
 
En atbantibiotics
En atbantibioticsEn atbantibiotics
En atbantibiotics
 
Hypertension guidelines2008to2010update
Hypertension guidelines2008to2010updateHypertension guidelines2008to2010update
Hypertension guidelines2008to2010update
 
Htn pharmacotherapy
Htn pharmacotherapyHtn pharmacotherapy
Htn pharmacotherapy
 
Malaria treatment protocol
Malaria treatment protocolMalaria treatment protocol
Malaria treatment protocol
 
Studying drug induced-disease
Studying drug induced-diseaseStudying drug induced-disease
Studying drug induced-disease
 
Strom11206
Strom11206Strom11206
Strom11206
 
Ad hoc reporting
Ad hoc reportingAd hoc reporting
Ad hoc reporting
 
2010 cv pharm slp
2010 cv pharm slp2010 cv pharm slp
2010 cv pharm slp
 

Recently uploaded

Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
FilipTomaszewski5
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
ThousandEyes
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
Mydbops
 
Day 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data ManipulationDay 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data Manipulation
UiPathCommunity
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
UiPathCommunity
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
leebarnesutopia
 
New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024
ThousandEyes
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
Enterprise Knowledge
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
Pablo Gómez Abajo
 
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to SuccessDynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
ScyllaDB
 
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time MLMongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
ScyllaDB
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
ScyllaDB
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
Cynthia Thomas
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
manji sharman06
 
Building a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data PlatformBuilding a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data Platform
Enterprise Knowledge
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
Larry Smarr
 
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
dipikamodels1
 

Recently uploaded (20)

Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeckPoznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
Poznań ACE event - 19.06.2024 Team 24 Wrapup slidedeck
 
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance PanelsNorthern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
Northern Engraving | Modern Metal Trim, Nameplates and Appliance Panels
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
 
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - MydbopsMySQL InnoDB Storage Engine: Deep Dive - Mydbops
MySQL InnoDB Storage Engine: Deep Dive - Mydbops
 
Day 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data ManipulationDay 4 - Excel Automation and Data Manipulation
Day 4 - Excel Automation and Data Manipulation
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
 
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdfLee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
Lee Barnes - Path to Becoming an Effective Test Automation Engineer.pdf
 
New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024
 
Demystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through StorytellingDemystifying Knowledge Management through Storytelling
Demystifying Knowledge Management through Storytelling
 
Mutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented ChatbotsMutation Testing for Task-Oriented Chatbots
Mutation Testing for Task-Oriented Chatbots
 
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to SuccessDynamoDB to ScyllaDB: Technical Comparison and the Path to Success
DynamoDB to ScyllaDB: Technical Comparison and the Path to Success
 
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time MLMongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
MongoDB vs ScyllaDB: Tractian’s Experience with Real-Time ML
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
 
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDBScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
ScyllaDB Leaps Forward with Dor Laor, CEO of ScyllaDB
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
 
Building a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data PlatformBuilding a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data Platform
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
From NCSA to the National Research Platform
From NCSA to the National Research PlatformFrom NCSA to the National Research Platform
From NCSA to the National Research Platform
 
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
Call Girls Kochi 💯Call Us 🔝 7426014248 🔝 Independent Kochi Escorts Service Av...
 

Base sas interview questions

  • 1. Base SAS Interview Questions Answers Leave a CommentPosted by sasinterviewsquestion on March 11, 2012 NOTE: The purpose of this post is to povide a learning for those preparing for SAS interview or global certification. Thus, all answers for the below mentioned questions are correct (for your learning). Questions are either asked directly or indirectly in SAS Interviews(2012). Question: What is the function of output statement? Answer: To override the default way in which the DATA step writes observations to output, you can use anOUTPUT statement in the DATA step. Placing an explicit OUTPUT statement in a DATA step overrides the automatic output, so that observations are added to a data set only when the explicit OUTPUT statement is executed. Question: What is the function of Stop statement? Answer: Stop statement causes SAS to stop processing the current data step immediately and resume processing statement after the end of current data step. Question : What is the difference between using drop= data set option in data statement and set statement? Answer: If you don‟t want to process certain variables and you do not want them to appear in the new data set, then specify drop= data set option in the set statement. Whereas If want to process certain variables and do not want them to appear in the new data set, then specify drop= data set option in the data statement. Question: Given an unsorted dataset, how to read the last observation to a new data set? Answer: using end= data set option. For example:
  • 2. data work.calculus; set work.comp end=last; If last; run; Where Calculus is a new data set to be created and Comp is the existing data set last is the temporary variable (initialized to 0) which is set to 1 when the set statement reads the last observation. Question : What is the difference between reading the data from external file and reading the data from existing data set? Answer: The main difference is that while reading an existing data set with the SET statement, SAS retains the values of the variables from one observation to the next. Question: What is the difference between SAS function and procedures? Answer: Functions expects argument value to be supplied across an observation in a SAS data set and procedure expects one variable value per observation. For example: data average ; set temp ; avgtemp = mean( of T1 – T24 ) ; run ; Here arguments of mean function are taken across an observation.
  • 3. proc sort ; by month ; run ; proc means ; by month ; var avgtemp ; run ; Proc means is used to calculate average temperature by month (taking one variable value across an observation). Question: Differnce b/w sum function and using “+” operator? Answer: SUM function returns the sum of non-missing arguments whereas “+” operator returns a missing value if any of the arguments are missing. Example: data mydata; input x y z; cards; 33 3 3 24 3 4 24 3 4 . 3 2 23 . 3 54 4 . 35 4 2 ; run;
  • 4. data mydata2; set mydata; a=sum(x,y,z); p=x+y+z; run; In the output, value of p is missing for 3rd, 4th and 5th observation as : a p 39 39 31 31 31 31 5 . 26 . 58 . 41 41 Question: What would be the result if all the arguments in SUM function are missing? Answer: a missing value Question: What would be the denominator value used by the mean function if two out of seven arguments are missing? Answer: five Question: Give an example where SAS fails to convert character value to numeric value automatically? Answer: Suppose value of a variable PayRate begins with a dollar sign ($). When SAS tries to automatically convert the values of PayRate to numeric values, the dollar sign blocks the process. The values cannot be converted to numeric values.
  • 5. Therefore, it is always best to include INPUT and PUT functions in your programs when conversions occur. Question: What would be the resulting numeric value (generated by automatic char to numeric conversion) of a below mentioned character value when used in arithmetic calculation? 1,735.00 Answer: a missing value Question: What would be the resulting numeric value (generated by automatic char to numeric conversion) of a below mentioned character value when used in arithmetic calculation? 1735.00 Answer: 1735 Question: Which SAS statement does not perform automatic conversions in comparisons? Answer: where statement Question: Briefly explain Input and Put function? Answer: Input function – Character to numeric conversion- Input(source,informat) put function – Numeric to character conversion- put(source,format) Question: What would be the result of following SAS function(given that 31 Dec, 2000 is Sunday)? Weeks = intck („week‟,‟31 dec 2000′d,‟01jan2001′d); Years = intck („year‟,‟31 dec 2000′d,‟01jan2001′d);
  • 6. Months = intck („month‟,‟31 dec 2000′d,‟01jan2001′d); Answer: Weeks=0, Years=1,Months=1 Question: What are the parameters of Scan function? Answer: scan(argument,n,delimiters) argument specifies the character variable or expression to scan n specifies which word to read delimiters are special characters that must be enclosed in single quotation marks Question: Suppose the variable address stores the following expression: 209 RADCLIFFE ROAD, CENTER CITY, NY, 92716 What would be the result returned by the scan function in the following cases? a=scan(address,3); b=scan(address,3,‟,'); Answer: a=Road; b=NY Question: What is the length assigned to the target variable by the scan function? Answer: 200 Question: Name few SAS functions?
  • 7. Answer: Scan, Substr, trim, Catx, Index, tranwrd, find, Sum. Question: What is the function of tranwrd function? Answer: TRANWRD function replaces or removes all occurrences of a pattern of characters within a character string. Question: Consider the following SAS Program data finance.earnings; Amount=1000; Rate=.075/12; do month=1 to 12; Earned+(amount+earned)*(rate); end; run; What would be the value of month at the end of data step execution and how many observations would be there? Answer: Value of month would be 13 No. of observations would be 1 Question: Consider the following SAS Program data finance;
  • 8. Amount=1000; Rate=.075/12; do month=1 to 12; Earned+(amount+earned)*(rate); output; end; run; How many observations would be there at the end of data step execution? Answer: 12 Question: How do you use the do loop if you don‟t know how many times should you execute the do loop? Answer: we can use do until or do while to specify the condition. Question: What is the difference between do while and do until? Answer: An important difference between the DO UNTIL and DO WHILE statements is that the DO WHILE expression is evaluated at the top of the DO loop. If the expression is false the first time it is evaluated, then the DO loop never executes. Whereas DO UNTIL executes at least once. Question: How do you specify number of iterations and specific condition within a single do loop? Answer: data work;
  • 9. do i=1 to 20 until(Sum>=20000); Year+1; Sum+2000; Sum+Sum*.10; end; run; This iterative DO statement enables you to execute the DO loop until Sum is greater than or equal to 20000 or until the DO loop executes 10 times, whichever occurs first. Question: How many data types are there in SAS? Answer: Character, Numeric Question: If a variable contains only numbers, can it be character data type? Also give example Answer: Yes, it depends on how you use the variable Example: ID, Zip are numeric digits and can be character data type. Question: If a variable contains letters or special characters, can it be numeric data type? Answer: No, it must be character data type. Question; What can be the size of largest dataset in SAS? Answer: The number of observations is limited only by computer‟s capacity to handle and store them.
  • 10. Prior to SAS 9.1, SAS data sets could contain up to 32,767 variables. In SAS 9.1, the maximum number of variables in a SAS data set is limited by the resources available on your computer. Question: Give some example where PROC REPORT’s defaults are different than PROC PRINT’s defaults? Answer: No Record Numbers in Proc Report Labels (not var names) used as headers in Proc Report REPORT needs NOWINDOWS option Question: Give some example where PROC REPORT’s defaults are same as PROC PRINT’s defaults? Answer: Variables/Columns in position order. Rows ordered as they appear in data set. Question: Highlight the major difference between below two programs: a. data mydat; input ID Age; cards; 2 23 4 45 3 56 9 43
  • 11. ; run; proc report data = mydat nowd; column ID Age; run; b. data mydat1; input grade $ ID Age; cards; A 2 23 B 4 45 C 3 56 D 9 43 ; run; proc report data = mydat1 nowd; column Grade ID Age; run; Answer: When all the variables in the input file are numeric, PROC REPORT does a sum as a default.Thus first program generates one record in the list report whereas second generates four records.
  • 12. Question: In the above program, how will you avoid having the sum of numeric variables? Answer: To avoid having the sum of numeric variables, one or more of the input variables must be defined as DISPLAY. Thus we have to use : proc report data = mydat nowd; column ID Age; define ID/display; run; Question: What is the difference between Order and Group variable in proc report? Answer: If the variable is used as group variable, rows that have the same values are collapsed. Group variables produce list report whereas order variable produces summary report. Question: Give some ways by which you can define the variables to produce the summary report (using proc report)? Answer: All of the variables in a summary report must be defined as group, analysis, across, or Computed variables. Questions: What are the default statistics for means procedure? Answer: n-count, mean, standard deviation, minimum, and maximum
  • 13. Question: How to limit decimal places for variable using PROC MEANS? Answer: By using MAXDEC= option Question: What is the difference between CLASS statement and BY statement in proc means? Answer: Unlike CLASS processing, BY processing requires that your data already be sorted or indexed in the order of the BY variables. BY group results have a layout that is different from the layout of CLASS group results. Question: What is the difference between PROC MEANS and PROC Summary? Answer: The difference between the two procedures is that PROC MEANS produces a report by default. By contrast, to produce a report in PROC SUMMARY, you must include a PRINT option in the PROC SUMMARY statement. Question: How to specify variables to be processed by the FREQ procedure? Answer: By using TABLES Statement. Question: Describe CROSSLIST option in TABLES statement? Answer: Adding the CROSSLIST option to TABLES statement displays crosstabulation tables in ODS column format. Question: How to create list output for crosstabulations in proc freq?
  • 14. Answer: To generate list output for crosstabulations, add a slash (/) and the LIST option to the TABLES statement in your PROC FREQ step. TABLES variable-1*variable-2 <* … variable-n> / LIST; Question: Proc Means work for ________ variable and Proc FREQ Work for ______ variable? Answer: Numeric, Categorical Question: How can you combine two datasets based on the relative position of rows in each data set; that is, the first observation in one data set is joined with the first observation in the other, and so on? Answer: One to One reading Question: data concat; set a b; run; format of variable Revenue in dataset a is dollar10.2 and format of variable Revenue in dataset b is dollar12.2 What would be the format of Revenue in resulting dataset (concat)? Answer: dollar10.2 Question: If you have two datasets you want to combine them in the manner such that observations in each BY group in each data set in the SET statement are read sequentially, in the order in which the data sets and BY variables are listed then which method of combining datasets will work for this? Answer: Interleaving
  • 15. Question: While match merging two data sets, you cannot use the __________option with indexed data sets because indexes are always stored in ascending order. Answer: Descending Question: I have a dataset concat having variable a b & c. How to rename a b to e & f? Answer: data concat(rename=(a=e b=f)); set concat; run; Question : What is the difference between One to One Merge and Match Merge? Give example also.. Answer: If both data sets in the merge statement are sorted by id(as shown below) and each observation in one data set has a corresponding observation in the other data set, a one-to-one merge is suitable. data mydata1; input id class $; cards; 1 Sa 2 Sd 3 Rd 4 Uj ;
  • 16. data mydata2; input id class1 $; cards; 1 Sac 2 Sdf 3 Rdd 4 Lks ; data mymerge; merge mydata1 mydata2; run; If the observations do not match, then match merging is suitable data mydata1; input id class $; cards; 1 Sa 2 Sd 2 Sp 3 Rd 4 Uj
  • 17. ; data mydata2; input id class1 $; cards; 1 Sac 2 Sdf 3 Rdd 3 Lks 5 Ujf ; data mymerge; merge mydata1 mydata2; by id run;
  翻译: