All Courses
SAS Interview Questions

SAS Interview Questions and Answers

SAS Interview Questions and Answers

In case you’re searching for SAS Interview Questions and answers for Experienced or Freshers, you are at the correct place. SAS Interview Question and Answers posted here will enable you all to easily learn the tricky concepts which are frequently asked in most of the SAS interviews. SAS is one of the most famous Data Analytics tool available in today’s market. The questions are separated as per the difficulty levels and hence this would help different level of people. As the list is prepared by experienced professionals, you will be greatly benefited. This is a one-stop place where you can easily gather the important concepts like Data Manipulation, SAS Macros, Reporting, SQL Queries, different SAS functions and statements, available operators, and many more. SAS is one of the leads in market comprised with various corporate jobs. If you are planning to get into role of SAS Programmer, Data Analytics, Business Analyst, and Statistical Programmer, it is better to go through all the posted questions and answers on SAS concept.

There is parcel of chances from many presumed organizations on the planet. The SAS advertise is relied upon to develop to more than $5 billion by 2020, from just $180 million, as per SAS industry gauges. In this way, despite everything you have the chance to push forward in your vocation in SAS Development. Gangboard offers Advanced SAS Interview Questions and answers that assist you in splitting your SAS interview and procure dream vocation as SAS Developer.

Best SAS Interview Questions and Answers

Do you believe that you have the right stuff to be a section in the advancement of future SAS , the GangBoard is here to control you to sustain your vocation. Various fortune 1000 organizations around the world are utilizing the innovation of SAS to meet the necessities of their customers. SAS is being utilized as a part of numerous businesses. To have a great development in SAS work, our page furnishes you with nitty-gritty data as RPA prospective employee meeting questions and answers. SAS Interview Questions and answers are prepared by 10+ years experienced industry experts. SAS Interview Questions and answers are very useful to the Fresher or Experienced person who is looking for the new challenging job from the reputed company. Our SAS Questions and answers are very simple and have more examples for your better understanding.

By this SAS Interview Questions and answers, many students are got placed in many reputed companies with high package salary. So utilize our SAS Interview Questions and answers to grow in your career.

Q1) Can you get Survival Ratings in any other Practice?

Answer: PROC LIFEREG and PROC Breggy can also be used to obtain bio-estimates with PROC LIFETEST.

Q2) Data Stigmatization Have you ever used ProcSql?

Answer: Yes, I used it briefly at times … For example, patients should compute the maximum value of BP 101 102 and 103 for patients with maximum value and utility group to achieve maximum value.

Q3) Tell me about your SQL experience?

Answer: I’ve used SAS / ACCESS SQL Pass Router facilities for importing external databases and importing Microsoft Access and Excel files. Besides, I use PROC SQL to join the table several times.

Q4) Do you need to read the data in the Saas Data Setter as a Data Step Programmer or a ProcSql Programmer?

Answer: It depends on what the need for analytical databases that generate tables but it also gives me more flexibility as a data-step programmer. Eg, sometimes I have to retain some values while creating a change from the basic data set for blood pressure … Use the rows … or use it first. And last. Variables.

Q5) What programming languages do you use ProcSql against the data level?

Answer: Prague SQL is the most convenient way to add a table to compare data form with no need to pre-sort the main columns. Tracking processing is more appropriate by a data-line sequence monitoring. U can choose to filter variables or save for a long time when choosing … Apply form … new variables, macro variables … as well as setting up data sub.PROC provides better flexibility for joining SQL table.

Q6) Where should I read in a Raw Data Form?

Answer: No. I do not think it can be used.

Q7) How do you connect data in ProcSQL?

PROC SQL;
Create a TABLE
Choose A.PATIENT,
A.DATE FORMAT = DATE7. On DATE,
A.PULSE, B.MED, B.DOSES,
B.AMT FORMAT = 4.1
Importance is an INNER joining DOSING B
ON (A.PATIENT = B.PATIENT)
And (A.DATE = B.DATE)
PATIENT mandate, DATE;
Give up;

Q8) Why do you use PROC SQl?

Answer: PROC SQL is the most convenient way to add a table to compare data form with no need to pre-sort the main columns. A data step is suitable for tracking processing through serial sequencing. If you want to filter variables when selecting, or modify them, design and create new variables and macro variables, the PROC can store a large time for SQL time. As well as subsetting data. PROC provides better flexibility for joining SQL table.

Q9) Difference Between Proc Material & Proc Compression?

Answer:

  •  PROC Summary defaults to NO PRINT PROC is the default for PRINT
  •  If you exclude the VAR statement, PROC SUMMARY creates a simple calculation, while PROC MEANs are trying to analyze all the variables that are not listed in other reports.
  •  If you specify statistics in the PROC SUMMARY statement, if the VAR report is excluded, the PROC SUMMARY process prevents and the error message is written to the SAS log.
  •  If you delete the VAR statement, PROC MEANS analyzes all the variables that are not listed in other reports. When all variables are character variables, the brooch produces a simple number.

Q10) How would you write a code to create a SAS data with any data? `Or how does it check a data structure without real creation?

Answer:

  • Use OPTIONS OBS = 0
  •  Creating a data set using such rules.

Ex: PROCSQL;
Create oracle.emp like table latha.emp;
Give up;
This triggers a table schedule in a table to copy it to a new table. Using this method
The result of creating a blank table.

  • data testing;

_null_;
Run;

  •  data testing;

Clear;

Q11) Do You Use the Proc Report or Proc Toolbar? Do you like

Answer: I would like to Proc report that I can define each column in any way I like, and it is very custom and flexible to use SAS functions, logic process, and assignment reports and create new ones.Variables to use the Pro report’s Account Statement report. I mentioned the complaint, because this is a very efficient tool.

Q12) How is the input file readable to Sauce?

Answer: Use the INFILE statement to point to the file’s reference (to be defined by the filename) / file. Use the INPUT statement to read data in the SAS database.

Q13) How do you remove a shape filled with a variable permanently?

Answer: You can remove the design by using proc datasets:

Proc datasets;
<Data set name> change;
Format <variable name> (This requires the variable format
Change>;
Run;
Give up;

Q14) How to display a data copy observation using basic sauce?

Answer: There are two ways to display duplicate observations:

  • According to data, first.var and last.var
  • Option dup out option using proc type.

Q15) The flow of data step process, what is the first step of a routine data?

Answer:  compiling phase:
When you submit a DATA hierarchy, it reads the input statement that generates the input statement and provides variables and observations. It brings observations at a time from a logical memory and input buffer
And checks errors. PDV 2 contains automatic variables _n_ & _error_, which checks errors in them.
_n_: Does not interrupt.
If there is an error, _error_: 1
If 0 error
Then, it changes the data model variable, and creates a SAS database.

Q16) How did you analyze and create data packages?

Answer: Analytics data only databases used for database statistical analysis. Analysis databases include source data and variables derived from source data. Variants derived from source data are used to produce TLG of medical research. Safety and performance terminals (parameters) command databases to be classified by clinical studies to generate TLG’s statistical report. Sometimes analytical databases are not required to create a statistical report, but sometimes they may need to create an ad hoc statement.

Q17) What materials are created when reading a SAS data set?

Answer: PDV is only made up of compiled time, while auto variables _N_ and _ERROR_ are created only at the time of execution.

Q18) How will the SaaS program be confirmed?

Answer: If you submit a SAS code, the SAS syntax checks before the program / code is executed. In that case, one of the ways – at the beginning of the code, OPTIONS adds OBS = 0 to other options, then to write it down.This way the data will not be processed and the log shows any errors / warnings.If you have enabled SAS code on PC SAS, the highlighted colors automatically shows the dialog errors.

Q19) Will you describe the three sauces you used?

Answer: Press – The SAS function used to remove the gaps on the string behalf and the combination of two values by the gaps.
The input is the function of another function, which is the function of switching to SAS. It mounts in the 0imagination.
Another alternative function in the chassis This changes the char.
SAS functions can be used to change the data and handle the character variable values.
Various types of functions:

  • TRIM
  • SUBSTR
  • ABS
  • Scan

TRIM: Deleting backlink holes from writing expressions.
Syntax = trim (argument)
SUBSTR: Substrate substring extracts from an argument
syntax = substr (argument, position <, n>)
Abs: Provides the whole of argument
Syntax = null (argument)
Common functions used-
Change functions – input / layer / int / seal / floor
Character Operations – Scan / Subfield / Index / Led / Trim / Compress / Boot / Gate / / Berkes, Lexus
Arithmetic functions – Co-op / AS /
Attribute info attributes – Attrn / Length
Database – Open / Open / Close
Directory – decisive / toopon / tocos / trit / dffo
File functions – Foxist / Foenen / File / Folder
SQL functions – combination / count / sum / average
Date c

Q20) Are the areas of clinical trials described?

Answer: These are the four stages of clinical trials:

  •  Phase 1: Check a new drug or treatment for a small group (20-80) to assess its safety.
  • Phase 2: Testing drug or treatment is given by a large group (100-300) and see if medications are effective or not.
  • Phase 3: An experimental drug or treatment is a large group (1000-3000) to see its efficacy, monitor side effects and compare with commonly used therapists.
  •  Phase 4: 4 phase study drug addiction studies include drug addiction, benefits etc.

Q21) How do you verify TLG as an Analysis Data System to describe the verification procedure?

Answer: The verification process is used to verify the output of the SAS program created by the source programmer. Write a program and write the output to the validator in this process. If this release is a publication produced by the SAS programmer, the program is considered valid. We can do this verification for TLG by checking the output manually and doing this using the analytics data setting PROC COMPARE.

Q22) How can you evaluate a list of 400 pages?

Answer: Can not validate 400 pages manually. To do this, use the PROC statement to modify the list of data lists and then compare the PROC to compare it.

Q23) Can you use Proc to check the listings? Why?

Answer: Yes, we can use the PROC to check the list because many of the entries (pages) in the lists can not be verified manually. So in this case we compare the PROC to check the lists.

Q24) How do you create tables, lists, and drawings?

Answer: Create listings by using the PROC statement. You can also create a table using PROC FREQ, PROC MEANs and PROC TRANSPOSE and PROC statement. We will create a map using ProcGplot.

Q25) How do you submit FDA Docs? Who submits the document?

Answer: Documents can be filed by FDD. Submit Docs to the FDA
Define.pdf or define.Xml forms. This document contains documents about macros and program and e-recordings. Statistical or Project Manager will submit this document to the FDA.

Q26) What documents do you have to submit to the FDA?

Answer:  ISS and ISE We submit the documents to the FDA.

Q27) Tell me about your planning team? Whom do you contact

Answer: My project team has six members, a project manager, two statisticians, lead programmer and two programmers. I usually inform the leading programmer. If there is any problem related to programming, I will contact the leading programmer.If I have any doubts in the variables values in the source database I need to contact the statistical. For example, if the database associated with menstrual symptoms in women is wrong with the values of values such as F and M.; In those kinds of situations I should contact the statistician

Q28) Explain the SaaS Document.

Answer: SAS documents include projector title, comments, headings, footnotes. The program is easily readable and easily understood as SAS documents

Q29) What is CRT?

Answer: Case Report Tabulation, Whenever a pharmaceutical company is submitting an NDA, conpany has to send the CRT’s to the FDA.

Q30) What Are The Contents Of Lab Data? What Is The Purpose Of Data Set?

Answer: The lab data set contains the SUBJID, week number, and category of lab test, standard units, low normal and high range of the values. The purpose of the lab data set is to obtain the difference in the values of key variables after the administration of drug.

Q31) If you have CRT, if you have what you say, what did you say?

Answer: Yes, I have created a patient profile for my manager’s demands and statistics. I use PROC contents and PROC SQL to create a list of simple patient with all information about a specific patient, including age, gender, race etc.

Q32) Have you created traffic files?

Answer: Yes, I have a copy of the proximity and the FDA. I have created SAS XPport files using the data form for submissions. These are version 5 files. We use a database in each xport transport format, with the Lybin Engine and Proc Copy procedure. For version 5: Labels are 40 bytes, variable names are 8 bytes, and the character variables are 200 bytes. Because SAS xport format complies with SAS 5 databases, these restrictions can be withheld by your copy process restrictions.
Libnamesdtm “c: sdtm_data”; Libnamedmxport “c: dm.xpt”; Freak copy = In Sdtm; Out = dm; Dm; Run;

Q33) How do you write a test plan?

Answer: Before you write “test aim” you need to see for “operational notes”. Functional notes are default dependent on “requirements”, so the requirements and functional notes to write a test plan should be clearly understood.

Q34) What is the difference between verification and verification?

Answer: While verification and validation are close to the meaning, “verification” is more than just checking the accuracy or accuracy of a statement, or experimenting, while it also has a sense of “true” declaring a statement with a sign of official endorsement.

Q35) What is Proc Cdisc?

Answer: It comes as part of the new SAS procedure and SAS 9.1.3, which is warm to the SAS 8.2 version. PROC CDISC is a process (CDISC allows the XML files to be compatible with the CDISC ODM version 1.2 Schema, for more details on the SAS programming pharmaceutical manuscript.

Q36) Describe Sdtm?

Answer: The CDISC’s Research Data Index Model (SDTM) was developed to obtain the standard submitted to the FDA.

Q37) What are the Mao Libraries?

Answer:  Macro Libraries are libraries which store all the macros for the development of TLG for clinical trials. These are necessary to control and manage macros. With the help of the INCLUDE statement; The macros stored in the Macro library are automatically called.

Q38) Why do you use ODS?

Answer: ODS (output delivery system) is typically used to generate output of tables, lists, and diagrams. Creates ODS outputs in html, pdf and rtf formats.

Q39) What is Gret?

Answer: If a case is filed by an NDA, the CRP should send it to the FDA.

Q40) How to create statistics using ProcSql?

Answer: Yes, we can create statistics like ST, SQL, N, average, average, max, at least, STD & SUM. However, the SQL procedure does not compute the above statistics because it applies to PROC MEANS.

Q41) When using ProcSql?

Answer: All the functions in the DATA form for data formation and manipulation of data are called LLC. Supports the procedure. Compared to the same results obtained from SQL and Data Form, PROC SQL requires less code, and more importantly it requires less time to run the code.

Q42) What is the procedure used to create a statement?

Answer: Proc Report, proc table and data _null_.

Q43) What is the difference between Stratam and opinion in the project life?

Answer: We refer to the BY statement with PROC LIFETEST to get individual analyzes in observations defined by BY variables.

Q44) What are the benefits of using sauces in Clinical Data Management?

Answer: Need less hardware and fewer employees.

Q45) Explain the verification process?

Answer: The verification process is used to verify the output of the SAS program, which was created by the source programmer. Write a program and write the output to the validator in this process.

Q46) Can you get some values that differ from data in a different software application? How are you doing it?

Answer: Use a macro. with a% PUT statement.

Q47) If you have registered, will you get previous records in previous recordings?

Answer: Using Ampersand Ident .

Q48) What is a value? Why do u calculate? What are the procedures you can use?

Answer: If greater than P-value 0.05, independent variables with independent variables can not be related to a relative constant relationship, or the independent variables group can not be credited to a reliable variable. Whether independent variables predicted the band’s reliable speed, it is an overall assessment to assess independent independent variables that do not have any ability to calculate the independent variability. We calculate p-value using PROC FREQ, PROC ANOVA, PROC GLM and PROC TTEST.

Q49) What do you usually do with Proc’s life test?

Answer: Prose life is used to obtain Kaplan-Meier and Life Table survival estimates (and layers). ProcLifetest uses a tier statement, which compares the biometrics for different groups.

Q50) What will be the output of the below Program?

DATA ;
Intck_value = INTCK(‘year’, ’31DEC1960’d, ’31DEC2005’d, ‘continuous’) ;
RUN ;

  1. 45
  2. 46
  3. None of the above
  4. SAS Error

Answer: a

Q51) What will be output by the below Program with below datasets.

Dataset 1
DATA DS1 ;
INPUT Alpha $ Name $ ;
DATALINES ;
G Grape
A Apple
M Mango
;
RUN ;
Dataset 2
INPUT Alpha $ Name $ ;
DATALINES ;
EE Element
ZZ Zebra
CC Cat
TT Tiger
DD Dog
;
RUN ;
a)

Obs Alpha Name
1 G Grape
2 A Apple
3 M Mango
b)
Obs Alpha Name
1 EE Element
2 ZZ Zebra
3 CC Cat
4 TT Tiger
5 DD Dog
c) None of the above
d) SAS Error
Answer : a

Q52) Which one is not a Statistical Procedure

  1. CORR
  2. STATS
  3. FREQ
  4. UNIVERATE

Answer: b

Q53) What will happen if the below code Executed

PROC PRINT ;

  1. SAS Error
  2. Print all Datasets from WORK library
  3. Execute successfully without Printing any dataset
  4. Print the recently created dataset

Answer: d

Q54)  Which PROC will use Quit instead of RUN

  1. CONTENTS
  2. GPLOT
  3. FREQ
  4. All the above
  5. None of the Above

Answer: e

Q55)  Which one is not Default descriptive statistics for PROC MEAnswer

  1. N
  2. MEAN
  3. MIN
  4. MEDIAN

Answer : d

Q56) Which function will used for below output

First_Name = ‘ Gang ‘ ;
Last_Name  = ‘ Board ‘ ;
Expected Output is : ‘Gang#Board’

  1. CAT(’#’, First_Name, Last_Name)
  2. CATS(’#’, First_Name, Last_Name)
  3. CATX(’#’, First_Name, Last_Name)
  4. CATC(’#’, First_Name, Last_Name)

Answer: c

Q57)  Which is not the Looping statement

  1. DO UNITL
  2. FOR
  3. DO WHILE
  4. CONTINUE UNTIL

Answer : d

Q58)  Which one is not used to declare / list the Inputs / Data inside SAS program itself

  1. DATALINES
  2. DATALINES4
  3. CARDS4
  4. INLINE

Answer : d

Q59)  Which is not the Data type in SAS

  1. DECIMAL
  2. INTEGER
  3. STRING
  4. None of the above
  5. All the above

Answer : d

Q60)  Which function remove ‘&’ in the below data

Full_Name = ‘Gang & Board’ ;
Expected Output is : Gang Board

  1. REMOVE
  2. COMPRESS
  3. CHANGE
  4. None of the above

Answer: b

Q61) How many Syntax Errors in the below PROC SQL Program

Dataset Name is DS2

Obs Alpha Name
1 G Grape
2 A Apple
3 M Mango
PROC SQ
SELECT Alpha Name
FROM WORK.DS2
QUIT ;

  1. 2
  2. 1
  3. 3
  4. No Syntax Error

Answer: c

Q62) SAS Date ‘0’ equals to

  1. No such Date
  2. 01/01/0001
  3. 01/01/1960
  4. 12/31/1959

Answer: c

Q63) Which statement will be used to SORT the dataset

  1. ORDER BY
  2. BY
  3. Both
  4. None of the above

Answer: b

Q64)  Sort cut to represent the below variables list

INPUT y a c h r z m s t;

  1. y – t
  2. y –- t
  3. y ~ t
  4. y to t

Answer: b

Q65)  Which conditional statement is faster & Time Saving when filtering large dataset

  1. IF condition
  2. WHERE condition
  3. No difference
  4. IF will be Faster with numeric and WHERE will be Faster with Character

Answer: b

Q66)  Which one is not the Logical Operator

  1. AND
  2. OR
  3. NOT
  4. IN

Answer : d

Q67)  What will be output for “PUT Salary DOLLAR13.2”

Salary value in the dataset is 1200001

  1. $1,200,001.00
  2. 1,200,001.00 $
  3. $ 1,200,001.00
  4. None of the above

Answer: a

Q68)  Which is Valid Dataset

  1. DATA _ ;
  2. DATA 012 ;
  3. DATA $ABC ;
  4. DATA A-Z ;

Answer: a

Q69) What area unit the most elements employed in SAS programming?

  1. Statements and variables
  2. Dataset and statements
  3. Dataset, statements and variables
  4. Variables

Answer: c

Q70) What is PROC?

Answer: gplot will produce additional vibrant and admirer graphics.

Q71) what’s CEIL?

Answer: The littlest whole number bigger than/equal to the argument.

Q72) Explained FLOOR?

Answer: Come back the best whole number less than/equal to the argument.

Q73) Explained right SAS Macros?

Answer: Sas macros  is used to debug system option MPRINT, MLOGIC, SYMBOLGEN

Q74) How to save log in AN external file?

Answer: The file save to the format  used to PROC PRINTTO

 Q75) what’s place Formatted?

Answer: PUT(formatted) statement in knowledge step is employed to put in writing a SAS knowledge set to a comma delimited file.

Q76) what’s PROC?

Answer: PROCs square measure sub-routine with a particular purpose in mind and also the knowledge step is meant to scan in and manipulate knowledge.

Q77) Explained SUMSTR?

Answer: SUMSTR – Used for extracting a string or exchange contents of character the info.

Q78) Explained knowledge & PROC?

Answer:

  • DATA step – ch recovers and manipulate knowledge
  • PROC step – ch interpret the info

Q79) what’s Input function?

Answer:

  • Input operate – character to numeric conversion(source, informat)
  • place operate – Numeric to character conversion (Put supply, informat)

Q80) How would you determine a macro variable?

  1. Sign
  2. with Ampersand (&) sign
  3. Ampersand
  4. Variable

Answer: b

Q81) What is the most volume of the macro variable?

  1.  48 characters long
  2.  30 characters long
  3.  32 characters long
  4.  25 characters long

Answer: c

 Q82) Mention What area unit the information varieties will Sas Contain?

  1. Numeric and Character
  2. Character
  3. Numeric
  4.  String

Answer: a

Q83) How Would You outline the tip Of A Macro?

  1.  %Mend Statement
  2.  Statement
  3. Parameters
  4.  Multiple data set

Answer: a

Q84) What is the length appointed to the target variable by the scan function?

  1. 250
  2. 100
  3. 320
  4. 200

Answer: d

Q85) How many observations would be there at the tip of information step execution?

  1. 20
  2. 27
  3. 12
  4. 32

Answer: c

Q86) Whatare the variable and letters or special characters, will it’s numeric knowledge type?

  1. Yes, it must be character data type
  2. No, it must be character data type
  3. No, only character
  4.  Yes, only data type

Answer: b

Q87) How to find the specify variables can be to the processed for FREQ procedure?

  1. By using TABLES Statement
  2. By using SUMMARY Statement
  3. By using MERGE Statement
  4.  By using SET Statement

Answer: a

Q88) Can PROC suggests that analyze solely the character variables?

  1. Yes, Proc meAnswer requires at least two numeric value
  2. No, Proc meAnswer requires at least two numeric value
  3. Yes, Proc meAnswer requires at least one numeric value
  4. No, Proc meAnswer requires at least one numeric value

Answer: d

Q89) What is interleaving in SAS?

Answer: Interleaving combines individual, sorted SAS data sets into one sorted SAS data set. You interleave data sets using a SET statement along with a BY statement. In the following example, the data sets are sorted by the variable Year. We can sort and then join the datasets on Year with the below code.

Q90) What will happen if we use multiple set statements?

Answer:

DATA dat1;
INPUT id v1 v2;
CARDS;
1 10 100
2 15 150
3 20 200
;
DATA dat2;
INPUT id v3 v4;
CARDS;
1 1000 10000
2 1500 15000
3 2000 20000
4 800 30000
;
RUN;
DATA dat3;
set dat1;
set dat2;
RUN;

If we use multiple set statements, whatever minimum number of observations which presents in any one of the datasets in set statements, that minimum number of observations will get copied in subsequent datasets of further set statements.

Q91) What is SAS informats?

Answer: SAS INFORMATS are used to read, or input data from external files known as Flat Files ASCII files, text files or sequential files). The informat will tell SAS on how to read data into SAS variables.

Q92) How SAS treats the DSD delimiters?

Answer:When you define DSD, SAS treats two consecutive delimiters as a missing value and removes quotation marks from character values.

Q93) Name statements that are recognized at compile time only?

Answer:drop, keep, rename, label, format, informat, attrib, where, by, retain, length, array.

Q94) How do you add a number to a macro variable?

Answer:Using %eval function or %sysevalf function if the number is a floating number.

Q95) How can we call macros with in the data step?

Answer:

We can call the macro with
CALL SYMPUT,
Proc SQL ,
%LET statement. and macro parameters.

Q96) If you have 100 variables in an dataset, How do you all the variables in a new dataset without copying the data?

Answer:

Data new_dataset;
set dataset;
if 0 then output new_dataset;
run;

Q97) Explain the Difference between Nodups and Nodupkey

Answer: NODUP will delete duplicated observations (records that are identical to each other) while NODUPKEY will delete those observations that have duplicate BY values (the sort BY variables that you name in PROC SORT).

Q98) What is variable length which is created by SCAN or TRNWRD function?

Answer: By Default, It would be assigning 200 characters.

The following SAS program is submitted:

data one;
addressl = ‘214 London Way’;
run;
data one;
set one;
address = tranwrd(address1, ‘Way’, ‘Drive’); run;

Q99) What are the length and value of the variable ADDRESS?

  1. Length is 14; value is ‘214 London Dri’.
  2. Length is 14; value is ‘214 London Way’.
  3. Length is 16; value is ‘214 London Drive’.
  4. Length is 200; value is ‘214 London Drive’.

Answer is: 4

Q100) How can I determine the position of the nth word within a character string?

Answer: Use a combination of the INDEXW and SCAN functions:pos= indexw(string,scan(string,n));

Q101) What do the PAD functiondo?

Answer:

PAD: it pads each record with blanks so that all data lines have the same length. It is used in the INFILE statement. It is useful only when missing data occurs at the end of the record.

Q102) How do you fetch only the even number observations from dataset?

Answer: if a datset has 9 observations then below code returns 2nd,4th,6th and 8th observation in output dataset.
data third;
Set old;
If  mod(_N_,2)=0;
Run;
INT: It returns the integer portion of a numeric value truncating the decimal portion.

Q103) Differencebetween translate and tranwrd

Answer:TRANSLATE can substitute one character for another in a string.  TRANWRD is more flexible—it can substitute a word or several words for one or more words.

Q104) Howwould you determine the number of missing or non-missingvalues in computations?

A)To determine the number of missing values that are excluded in a computation, use the NMISS function.
data _null_;
m = . ;
y = 4 ;
z = 0 ;
N = N(m , y, z);
NMISS = NMISS (m , y, z);
run;

The above program results in N = 2 (Number of non missing values) and NMISS = 1 (number of missing values).

Consider the following SAS Program
data earnings;
Amount=1000;
Rate=.075/12;
do month=1 to 12;
Earned+(amount+earned)*(rate);
end;
run;

Q105) 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  and No. of observations would be 1. Because output statement is not specified inside the do loop statement. By Default, output statement will be written after the do loop end statement.

Q106) How do you use the do loopif you don’t know how many times should you execute the do loop?

Answer:we can use do until or do whileto specify the condition.

Q107) If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didn’t have a value?

Answer:By using the option MISSOVER in the infile statement. If the input of some data lines are shorter than others then we use TRUNCOVER option in the infile statement

Q108) How would you create multiple observations from a single observation?

Answer: The double trailing @ not only prevents SAS from reading a new record into the input buffer when a new INPUT statement is encountered, but it also prevents the record from being released when the program returns to the top of the DATA step.

The trailing @ does not hold a record in the input buffer across iterations of the DATA step. @@ hold a record across iterations of data step.

SAS will hold the line of data until it reaches either the end of the line or an INPUT statement that does not end with the trailing@@.

Q109) What is called year cut off?

Answer: This value determines the start of a 100-year interval that SAS uses when it encounters a two-digit year. With a YEARCUTOFF value of 1920, all two-digit years are in the interval from 1920 to 2019. That is why the first date (8/10/65) is given the value 8/10/1965 and the second date (9/13/02) is given the value 9/13/2002.

Q110) How do you print all the numeric and character variables of dataset?

Answer:By using _numeric_ and _character_ , we can print all the numeric and character variables of the dataset.

Q111) What is Program Data Vector?

Answer:It is a logical memory area where SAS reads observation one at a time to build the SAS dataset. When a program executes:

Data from raw file is read into Input buffer and then into PDV one observation at a time

The data/observation is directly read into PDV, when SAS is reading from a SAS dataset

At the end: from PDV, SAS writes the values to a SAS Output data set as a single observation

Along with data set variables and computed variables, the PDV contains two automatic variables, _N_ and _ERROR_

sets up some automatic variables such as: _N_, _ERROR_, END=, IN=, FIRST, LAST, POINT=

Q112) How do you use the SAS Function with macro facility?

Answer:Yes, by using the %SYSFUNC macro function.

Example:- %put %sysfunc(date(),worddate20.);

Q113) What are compile time and run time quoting functions?

Answer:

Compile Time Quoting Functions:-

%STR–masks commas, mnemonics, and unmatched quotation marks and parentheses.

%NRSTR–masks percent signs and ampersands in addition to the other special characters.

Run Time Quoting Functions:-

%BQUOTE–masks special characters and mnemonics inresolved values during macro execution.

%SUPERQ–masks special characters and mnemonics during macro execution. However, it also prevents further resolution of any macros or macro variables.

Q114) How We Can Call Macros With In Data Step?

Answer:

We can call the macro with

  • CALL SYMPUT,
  • Proc SQL ,
  • %LET statement. and macro parameters.

Q115) If You Use A Symput In A Data Step, When And Where Can You Use The Macro Variable?

Answer:The macro variable created by the CALL SYMPUT routine cannot be used in the same datastep in which it got created. Other than that we can use the macro variable at any time.

Q116) What System Options Would You Use To Help Debug A Macro?

Answer:

MLOGIC: SAS prints details about the execution of the macros in the log.

MPRINT: Displays SAS statements generated by macro execution are traced on the SAS Log for debugging purposes.

SYMBOLGEN: SAS prints the value of macro variables in log and also displays text from expanding macro variables to the SAS Log.

MERROR: SAS will issue warning if we invoke a macro that SAS didn’t find. Presents Warning Messages when there are misspellings or when an undefined macro is called.

Q117) How do you sort large dataset?

Answer:Make your data set smaller: eliminate all unnecessary variables and set the LENGTH of variables to be no more than necessary (e.g., 3 for dummy variables, 4 for integers, etc,). these reduce the size of the file to be sorted dramatically & should always be done (if you haven’t already). since you only have 1.7 million records but the file is 4.5 GB, i’m guessing you might not have done this yet (or else the file is inherently very wide — see below). with data files of this size you need to think hard about how to reduce file size.

Try sorting subsets of the data & recombining them

  • If the file is very ‘wide’, split it into multiple files which all contain the sort variables but only contain some of the other variables; you can then do a MERGE/BY to recombine them.
  • If the files are very ‘long’, try subsetting the file the file (1/2 the obs in one file, 1/2 in another, say), sort them separately, and then interleave them in a data step.

Q118) What is SQL-Pass through Facility?

Answer:

The SQL Procedure pass-through facility is an extension of the SQL procedure that enables you to send DBMS-specific statements to a DBMS and to retrieve DBMS data. You specify DBMS SQL syntax instead of SAS SQL syntax when you use the pass-through facility. You can use pass-through facility statements in a PROC SQL query or store them in a PROC SQL view.

Q119) What are all the benefits of SAS Views?

Answer:

  • Instead of using multiple DATA steps to merge SAS data sets by common variables, you can construct a SAS view that performs a multi-table join.
  • You can save disk space by storing a SAS view definition. The view definition stores only the instructions for where to find the data and how it is formatted, not the actual data.
  • SAS views can ensure that the input data sets are always current because data is derived from SAS views at execution time.
  • Since SAS views can select data from many sources, once a SAS view is created, it can provide pre-packaged information to the information community without the need for additional programming.
  • SAS views can reduce the impact of data design changes on users. For example, you can change a querythat is stored in a SAS view without changing the characteristics of the view’s result.
Social Share:

0 responses on "SAS Interview Questions and Answers"

Leave a Message

Your email address will not be published. Required fields are marked *