YouTube Icon

Interview Questions.

Top 50 Sas Programming Interview Questions - Jul 28, 2022

fluid

Top 50 Sas Programming Interview Questions

Q1. How Are Numeric And Character Missing Values Represented Internally?

Character as Blank or  and Numeric as.

Q2. How Would You Create Multiple Observations From A Single Observation?

Using double Trailing @@.

Q3. What Is The Use Of Proc Sql?

PROC SQL is a powerful tool in SAS, which mixes the capability of statistics and proc steps. PROC SQL can sort, summarize, subset, be part of (merge), and concatenate datasets, create new variables, and print the outcomes or create a brand new dataset multi functional step! PROC SQL makes use of fewer resources while as compared to that of information and proc steps. To join files in PROC SQL it does no longer require to kind the records previous to merging, which is ought to, is information merge.

Q4. What Techniques And/or Procs Do You Use For Tables?

Proc Freq, Proc univariate, Proc Tabulate & Proc Report.

Q5. What Is The Difference Between: X=a+b+c+d; And X=sum (of A, B, C ,d);?

Is each person questioning why you wouldn’t just use overall=field1+field2+field3;

Q6. What Are Some Good Sas Programming Practices For Processing Very Large Data Sets?

Sampling approach the use of OBS alternative or subsetting, commenting the Lines, Use Data Null.

Q7. What Is The Different Between Functions And Procs That Calculate The Same Simple Descriptive Statistics?

Proc may be used with wider scope and the consequences can be sent to a different dataset. Functions usually have an effect on the existing datasets.

Q8. How Would You Create A Data Set With 1 Observation And 30 Variables From A Data Set With 30 Observations And 1 Variable?

Using PROC TRANSPOSE.

Q9. What Versions Of Sas Have You Used (on Which Platforms)?

SAS nine.1.Three,9.Zero, 8.2 in Windows and UNIX, SAS 7 and six.12.

Q10. How Do The In= Variables Improve The Capability Of A Merge?

The IN=variablesWhat in case you want to keep in the output information set of a merge simplest the matches (most effective the ones observations to which each input facts units make a contribution)? SAS will installation for you special transient variables, known as the "IN=" variables, so that you can do this and greater. Here's what you have to do: sign to SAS on the MERGE announcement which you want the IN= variables for the enter statistics set(s) use the IN= variables within the facts step as it should be, So to hold only the fits inside the in shape-merge above, ask for the IN= variables and use them:data 3;merge one(in=x) (in=y); /* x & y are your selections of names */via identity; /* for the IN= variables for data */if x=1 and y=1; /* units one and  respectively */run;

Q11. How Does Sas Handle Missing Values In: Assignment Statements, Functions, A Merge, An Update, Sort Order, Formats, Procs?

Missing values may be assigned as lacking in Assignment declaration. Sort order treats missing as 2nd smallest accompanied via underscore.

Q12. For What Purpose Would You Use The Retain Statement?

The keep statement is used to maintain the values of variables throughout iterations of the information step. Normally, all variables inside the statistics step are set to missing on the start of every iteration of the statistics step. What is the order of evaluation of the evaluation operators: + - * / ** ()?A) (), **, *, /, +, -.

Q13. How Do You Debug And Test Your Sas Programs?

First issue is investigate Log for errors or caution or NOTE in some instances or use the debugger in SAS data step.

Q14. What Do The Mod And Int Function Do? What Do The Pad And Dim Functions Do?

MOD: Modulo is a regular or numeric variable, the feature returns the reminder after numeric fee divided by modulo.

INT: It returns the integer part of a numeric cost truncating the decimal portion.

PAD: it pads every document with blanks so that every one information lines have the equal length. It is used within the INFILE statement. It is useful best whilst lacking data happens at the cease of the file.

CATX: concatenate person strings, removes leading and trailing blanks and inserts separators.

SCAN: it returns a certain word from a person fee. Scan feature assigns a period of 200 to every goal variable.

SUBSTR: extracts a sub string and replaces person values.Extraction of a substring:

Middleinitial=substr(middlename,1,1); Replacing character values: substr (phone,1,three)=’433’; If SUBSTR characteristic is on the left facet of a announcement, the feature replaces the contents of the man or woman variable.

TRIM: trims the trailing blanks from the character values.

SCAN vs. SUBSTR: SCAN extracts words inside a fee this is marked with the aid of delimiters. SUBSTR extracts a part of the cost by using stating the specific location. It is first-class used whilst we understand the precise function of the sub string to extract from a person cost.

Q15. Why Is Sas Considered Self-documenting?

SAS is considered self documenting because at some stage in the compilation time it creates and stores all the statistics about the facts set just like the time and date of the statistics set introduction later No. Of the variables later labels all that type of data inside the dataset and you may observe that data the use of proc contents manner.

Q16. How Could You Generate Test Data With No Input Data?

Using Data Null and positioned declaration.

Q17. What Is The Purpose Of _error_?

It has simplest to values, that are 1 for errors and zero for no errors.

Q18. What Do The Sas Log Messages "numeric Values Have Been Converted To Character" Mean? What Are The Implications?

It means that automated conversion happened to make character capabilities possible.

Q19. What Has Been Your Most Common Programming Mistake?

Missing semicolon and now not checking log after submitting program, Not the use of debugging techniques and not the use of Fsview option vigorously.

Q20. Why Is A Stop Statement Needed For The Point=alternative On A Set Statement?

When you use the POINT= choice, you need to include a STOP announcement to stop DATA step processing, programming logic that assessments for an invalid fee of the POINT= variable, or Both. Because POINT= reads simplest the ones observations which are special within the DO statement, SAS can not read an cease-of-record indicator as it would if the document have been being read sequentially. Because studying an end-of-document indicator ends a DATA step automatically, failure to substitute some other manner of finishing the DATA step while you operate POINT= can reason the DATA step to enter a non-stop loop.

Q21. What Other Sas Products Have You Used And Consider Yourself Proficient In Using?

Data _NULL_ assertion, Proc Means, Proc Report, Proc tabulate, Proc freq and Proc print, Proc Univariate and many others.

Q22. What Is The Difference Between Nodup And Nodupkey Options?

NODUP compares all of the variables in our dataset at the same time as NODUPKEY compares just the BY variables.

Q23. What Is A Method For Assigning First.Var And Last.Var To The By Groupvariable On Unsorted Data?

In unsorted data you cannot use First. Or Last.

Q24. Do You Prefer Proc Report Or Proc Tabulate? Why?

I prefer to use Proc document till I have to create pass tabulation tables, due to the fact, It gives me so many alternatives to adjust the appearance up of my desk, (ex: Width choice, by using this we can exchange the width of each column inside the desk) Where as Proc tabulate unable to provide some of the things in my table. Ex: tabulate doesn’t produce n (%) in the suitable layout.

Q25. What Is Enterprise Guide? What Is The Use Of It?

It is an approach to import textual content files with SAS (It comes free with Base SAS version 9.0).

Q26. How Can You Import .Csv File In To Sas?

To create CSV report, we ought to open notepad, then, declare the variables.

  Proc import datafile='E:age.Csv' 

out=sarath dbms=csv replace;

getnames=yes;

run;

Q27. How Do You Test For Missing Values?

Using Subset capabilities like IF then Else, Where and Select.

Q28. How Would You Determine The Number Of Missing Or Nonmissing Values In Computations?

To determine the variety of missing values which can be excluded in a computation, use the NMISS function.

Facts _null_;

m = . ;

y = four ;

z = 0 ;

N = N(m , y, z);

NMISS = NMISS (m , y, z);

run;

The above software outcomes in N = 2 (Number of non lacking values) and NMISS = 1 (quantity of missing values).

Q29. What Are Sas/get admission to And Sas/join?

SAS/Access simplest method through the databases like Oracle, SQL-server, Ms-Access and many others.

SAS/Connect most effective use Server connection.

Q30. What Does The Run Statement Do?

When SAS editor appears at Run it starts compiling the facts or proc step, if you have more than one facts step or proc step or if you have a proc step. Following the records step then you could keep away from the usage of the run declaration.

Q31. How Can You Create Zero Observation Dataset?

Creating a data set through using the like clause.Ex: proc square;create desk latha.Emp like oracle.Emp;give up;In this the like clause triggers the present desk shape to be copied to the brand new table. Using this approach result in the introduction of an empty table.

In the editor window we writep.Cinclude 'route of the sas record';run;if it's far with non-windowing surroundings no want to provide run assertion.

Q32. How Can You Put A "trace" In Your Program?

By the usage of ODS TRACE ON.

Q33. What Is The One Statement To Set The Criteria Of Data That Can Be Coded In Any Step?

Options assertion.

Q34. What Are The New Features Included In The New Version Of Sas I.E., Sas9.1.Three?

The main gain of version 9 is quicker execution of packages and centralized get admission to of statistics and guide.

There are lots of modifications has been made in the version nine whilst we as compared with the model @The following are the few:

SAS model nine helps Formats longer than eight bytes & isn't always possible with version @

Length for Numeric format allowed in model nine is 32 wherein as 8 in version @

Length for Character names in model 9 is 31 wherein as in model eight is three@

Length for numeric informat in model 9 is 31, eight in version @

Length for character names is 30, 32 in version eight.3 new informats are to be had in version nine to transform diverse date, time and datetime sorts of records right into a SAS date or SAS time.

ANYDTDTEW. - Converts to a SAS date cost

ANYDTTMEW. - Converts to a SAS time fee.

ANYDTDTMW. -Converts to a SAS datetime value.CALL SYMPUTX Macro assertion is added inside the version 9 which creates a macro variable at execution time within the facts step with the aid of

Trimming trailing blanks

Automatically changing numeric value to character.

New ODS alternative (COLUMN OPTION) is included to create a multiple columns in the output.

Q35. What Is The Difference Between Calculating The 'mean' Using The Mean Function And Proc Means?

By default Proc Means calculate the precis statistics like N, Mean, Std deviation, Minimum and maximum, Where as Mean feature compute simplest the mean values.

Q36. What Are _numeric_ And _character_ And What Do They Do?

Will both read or writes all numeric and person variables in dataset.

Q37. Name Several Ways To Achieve Efficiency In Your Program?

Efficiency and performance techniques may be categorised into 5 exceptional areas.

•CPU time

•Data Storage

• Elapsed time

• Input/Output

• Memory CPU Time and Elapsed Time- Base line measurements.

Q38. What Can You Learn From The Sas Log When Debugging?

It will display the execution of entire software and the good judgment. It may even display the mistake with line quantity so you can and edit this system.

Q39. What Are Input Dataset And Output Dataset Options?

Input facts set alternatives are obs, firstobs, wherein, in output information set alternatives compress, reuse.Both input and output dataset options include maintain, drop, rename, obs, first obs.

Q40. First, How Do You Want Missing Values Handled?

The SUM feature returns the sum of non-missing values. If you choose addition, you will get a lacking fee for the end result if any of the fields are missing. Which one is suitable depends upon your needs.However, there is a bonus to use the SUM characteristic even in case you need the results to be missing. If you've got more than a pair fields, you can regularly use shortcuts in writing the sphere names If your fields are not numbered sequentially but are saved in the program facts vector together then you could use: general=SUM(of fielda--zfield); Just ensure you don't forget the “of” and the double dashes or your code will run however you received’t get your meant results. Mean is some other feature where the function will calculate otherwise than the writing out the formula if you have missing values.There is a field containing a date. It wishes to be displayed within the layout "ddmonyy" if it's earlier than 1975, "dd mon ccyy" if it is after 1985, and as 'Disco Years' if it is among 1975 and 1985.

Q41. What Are Some Problems You Might Encounter In Processing Missing Values? In Data Steps? Arithmetic? Comparisons? Functions? Classifying Data?

The result of any operation with lacking price will result in lacking value. Most SAS statistical strategies exclude observations with any lacking variable values from an analysis.

Q42. If You Were Told To Create Many Records From One Record, Show How You Would Do This Using Array And With Proc Transpose?

Declare array for range of variables inside the report after which used Do loop Proc Transpose with VAR statement.

Q43. Which Date Functions Advances A Date Time Or Date/time Value By A Given Interval?

INTNX.

Q44. What Is The Effect Of The Options Statement Errors=1?

The –ERROR- variable has a value of one if there is an blunders inside the data for that statement and 0 if it isn't.

Q45. Which Date Function Advances A Date, Time Or Datetime Value By A Given Interval?

INTNX: INTNX characteristic advances a date, time, or datetime cost by using a given c program languageperiod, and returns a date, time, or datetime cost.

Ex: INTNX(c language,begin-from,wide variety-of-increments,alignment)

INTCK: INTCK(interval,begin-of-duration,cease-of-period) is an c program languageperiod functioncounts the wide variety of durations among  supply SAS dates, Time and/or datetime.

DATETIME () returns the cutting-edge date and time of day.

DATDIF (sdate,edate,foundation): returns the number of days among two dates.

Q46. In The Flow Of Data Step Processing, What Is The First Action In A Typical Data Step?

When you post a DATA step, SAS techniques the DATA step and then creates a brand new SAS records set.( advent of enter buffer and PDV)

Compilation Phase

Execution Phase.

Q47. What Is The Significance Of The 'of' In X=sum (of A1-a4, A6, A9);

If don’t use the OF characteristic it won't be interpreted as we expect. For example the feature above calculates the sum of a1 minus a4 plus a6 and a9 and now not the complete sum of a1 to a4 & a6 and a@It is genuine for mean choice also.

Q48. What Are The Scrubbing Procedures In Sas?

Proc Sort with nodupkey alternative, as it will cast off the reproduction values.

Q49. Do You Need To Know If There Are Any Missing Values?

Just use: missing_values=MISSING(field1,field2,field3);

This feature absolutely returns 0 if there are not any or 1 if there are missing values.If you need to understand what number of lacking values you have then use num_missing=NMISS(field1,field2,field3);

You also can discover the range of non-missing values with non_missing=N (field1,field2,field3);

Q50. What Are Some Differences Between Proc Summary And Proc Means?

Proc approach by default give you the output inside the output window and you could forestall this with the aid of the choice NOPRINT and might take the output in the separate report with the aid of the announcement OUTPUTOUT= , But, proc precis does not supply the default output, we should explicitly supply the output statement after which print the statistics by giving PRINT option to see the end result.




CFG