Sie sind auf Seite 1von 71

Basic SAS interview questions 1. 2. What is the effect of the OPTIONS statement ERRORS=1?

Whats the difference between VAR A1 - A4 and VAR A1 A4?

3. What do the SAS log messages "numeric values have been converted to character" mean? What are the implications? 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. Why is a STOP statement needed for the POINT= option on a SET statement? How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730? How would you remove a format that has been permanently associated with a variable?? What does the RUN statement do? Why is SAS considered self-documenting? What areas of SAS are you most interested in? Briefly describe 5 ways to do a "table lookup" in SAS. What versions of SAS have you used (on which platforms)? What are some good SAS programming practices for processing very large data sets? What are some problems you might encounter in processing missing values? In Data steps? Arithmetic? Comparisons? Functions? Classifying data?

15. How would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? 16. What is the different between functions and PROCs that calculate the same simple descriptive statistics? 17. If you were told to create many records from one record, show how you would do this using arrays and with PROC TRANSPOSE? What are _numeric_ and _character_ and what do they do? How would you create multiple observations from a single observation? For what purpose would you use the RETAIN statement? What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data?

18. 19. 20. 21.

22. What is the order of application for output data set options, input data set options and SAS statements? 23. 24. 25. What is the order of evaluation of the comparison operators: + - * / ** ( ) ? How could you generate test data with no input data? How do you debug and test your SAS programs?

26. 27. 28. 29. 30. 31.

What can you learn from the SAS log when debugging? What is the purpose of _error_? How can you put a "trace" in your program? Are you sensitive to code walk-throughs, peer review, or QC review? Have you ever used the SAS Debugger? What other SAS features do you use for error trapping and data validation?

32. How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs? 33. 34. 35. How many missing values are available? When might you use them? How do you test for missing values? How are numeric and character missing values represented internally?

Comments on Basic SAS interview questions What is the effect of the OPTIONS statement ERRORS=1? is printes on Log //If ERRORS=1 then only 1 data error statement

What does the RUN statement do? //it will excutes the programme. How would you remove a format that has been permanently associated with a variable? What do the SAS log messages numeric values have been converted to character mean? What are the implications? //These SAS log messages shows that the all of the numeric values have been converted to character values. When using the put function in your program, the numeric values are converted into character values. How are numeric and character missing values represented internally? //ans:basically charactor values are reprasented by blank space numaric values are reprasented by dot in sas data set. What does the RUN statement do? //ans: it is end of the program it executes the program. What areas of SAS are you most interested in? access. //ans:formats,macros,proc sql,ods,graphsand proc

How would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? //ANS:BY USING PROC TRANSPOSE. Que: For what purpose you use a retain statement? //Ans: To retain the value of a variable in subsequent iterations of the data step. What do the SAS log messages numeric values have been converted to character mean? What are the implications? //Ans) The message means that numeric values are converted into character values automatically whenever numeric data values are used in character context. If put function is used to explicitly convert numeric values to character values then no message is written to the log.

How do you control the number of observations and/or variables read or written? Ans) For controlling observations use OBS= option in the infile statement and for controlling variables use the VAR statement in the data step. Correction for Que5) Use the drop and keep options in the data statements. Approximately what date is represented by the SAS date value of 730? from Jan 1st 1960. 730=365+365=2 yrs = Jan 1st 1962 //Ans) SAS date value starts

How would you remove a format that has been permanently associated with a variable? //Ans) Open the dataset in viewtable window and right click on the columns whose format should be changed/removed and select column attributes from the pop up menu and then do the necessary changes. Why is a STOP statement needed for the POINT= option on a SET statement? is used to control the continuous looping in set stement //The STOP statement

Whats the difference between VAR A1 - A4 and VAR A1 A4? //A: VAR A1- A4 is a numbered range. Used as a shortcut to describe variables that have same char names and the numbers are in order. Var A1 A4 is the order of the variables as they occur in the data set, and is again a shortcut to refer them. You can see the order of the variables by using Proc Contents on the data file What do the SAS log messages numeric values have been converted to character mean? What are the implications? //A: Means SAS performed an automatic num to char conversion. Works for some cases, else do an explicit num to char conversion using PUT(VAR, format). What does the RUN statement do? //A: RUN stat menas the end of any Data or Proc steps before it and execute the stats. There can be as many RUN stats as you want to run blocks of steps separately. Q:What are some good SAS programming practices for processing very large data sets //A: Limit the no. of OBS using Firstobs= and obs=. Use a do loop and point= option to generate samples from the data sets. make sure you terminate the point= loop. Q: What are _numeric_ and _character_ and what do they do //A: the foist one means you want to work on all the numberis variables in your data set. example Mean( of _numeric_). Same with the char. Format _character_ $12. Q: How would you create multiple observations from a single observation? You can break up the single obs as per your need Q: What is the order of evaluation of the comparison operators: + - * / ** ( ) Bracket, Div, Multi, add, subtraction) Q: How can you put a trace in your program? //A: ODS Trace ON, ODS Trace OFF //A: USing @ or @@.

//A:

BODMAS

Q: Have you ever used the SAS Debugger? //A: YES. Start by submitting Data dat/ debug;..Debugger window opens. Execute each program line by hitting enter. After the last line type Examine _ALL_ in the command window to execute and check the variable values for one iteration of data step.. What is the meaning of proc append procedure?How to use this procedure? What is the SAS server name and configuration? What is the effect of the OPTIONS statement ERRORS=1?

What is the purpose of _error_? Approximately what date is represented by the SAS date value of 730? //Ans) SAS date value starts from Jan 1st 1960. 730=365+365=2 yrs =dec 31st 1961 How are numeric and character missing values represented internally? //a.character values represented blank numeric values are represented by dot. What is the order of evaluation of the comparison operators: + - * / ** ( ) BODMASbrackets,explonentation,multiplication addition substraction. //A:

What is the meaning of proc append procedure?How to use this procedure? //a.proc append procedure is used for adding one base dataset to existing dataset if incase there is mismatched variables then use force options. How would you remove a format that has been permanently associated with a variable? a.data ab; format ; run; Important SAS Interview Questions 1) 2) 3) 4) 5) 6) 7) 8) 9) 10) 11) 12) 13) 14) 15) 16) 17) 18) 19) 20) What has been your most common programming mistake? What is your favorite programming language and why? What is your favorite operating system? Why? Do you observe any coding standards? What is your opinion of them? What percent of your program code is usually original and what percent copied and modified? Have you ever had to follow SOPs or programming guidelines? Which is worse: not testing your programs or not commenting your programs? Name several ways to achieve efficiency in your program. Explain trade-offs. What other SAS products have you used and consider yourself proficient in using? How do you make use of functions? When looking for contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? What is the significance of the OF in X=SUM(OF a1-a4, a6, a9);? What do the PUT and INPUT functions do? Which date function advances a date, time or date/time value by a given interval? What do the MOD and INT function do? How might you use MOD and INT on numerics to mimic SUBSTR on character strings? In ARRAY processing, what does the DIM function do? How would you determine the number of missing or nonmissing values in computations? What is the difference between: x=a+b+c+d; and x=SUM(a,b,c,d);? There is a field containing a date. It needs to be displayed in the format ddmonyy if its before 1975, dd mon ccyy if its after 1985, and as Disco Years if its between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT. In the following DATA step, what is needed for fraction to print to the log? data _null_; x=1/3; if x=.3333 then put fraction; run; What is the difference between calculating the mean using the mean function and PROC MEANS? Have you ever used Proc Merge? (be prepared for surprising answers..)

21) 22) 23)

24) If you were given several SAS data sets you were unfamiliar with, how would you find out the variable names and formats of each dataset? 25) What SAS PROCs have you used and consider yourself proficient in using? 26) How would you keep SAS from overlaying the a SAS set with its sorted version? 27) In PROC PRINT, can you print only variables that begin with the letter A? 28) What are some differences between PROC SUMMARY and PROC MEANS? 29) Code the tables statement for a single-level (most common) frequency. 30) Code the tables statement to produce a multi-level frequency. 31) Name the option to produce a frequency line items rather that a table. 32) Produce output from a frequency. Restrict the printing of the table. 33) Code a PROC MEANS that shows both summed and averaged output of the data. 34) Code the option that will allow MEANS to include missing numeric data to be included in the report. 35) Code the MEANS to produce output to be used later. 36) Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain. 37) What happens in a one-on-one merge? When would you use one? 38) How would you combine 3 or more tables with different structures? 39) What is a problem with merging two data sets that have variables with the same name but different data? 40) When would you choose to MERGE two data sets together and when would you SET two data sets? 41) Which data set is the controlling data set in the MERGE statement? 42) How do the IN= variables improve the capability of a MERGE? 43) Explain the message MERGE HAS ONE OR MORE DATASETS WITH REPEATS OF BY VARIABLES. 44) How would you generate 1000 observations from a normal distribution with a mean of 50 and standard deviation of 20. How would you use PROC CHART to look at the distribution? Describe the shape of the distribution. 45) How do you generate random samples? 46) What is the purpose of the statement DATA _NULL_ ;? 47) What is the pound sign used for in the DATA _NULL_? 48) What would you use the trailing @ sign for? 49) For what purpose(s) would you use the RETURN statement? 50) How would you determine how far down on a page you have printed in order to print out footnotes? 51) What is the purpose of using the N=PS option? 52) What system options would you use to help debug a macro? 53) Describe how you would create a macro variable. 54) How do you identify a macro variable? 55) How do you define the end of a macro? 56) How do you assign a macro variable to a SAS variable? 57) For what purposes have you used SAS macros? 58) What is the difference between %LOCAL and %GLOBAL? 59) How long can a macro variable be? A token? 60) If you use a SYMPUT in a DATA step, when and where can you use the macro variable? 61) What do you code to create a macro? End one? 62) Describe how you would pass data to a macro. 63) You have five data sets that need to be processed identically; how would you simplify that processing with a macro? 64) How would you code a macro statement to produce information on the SAS log? This statement can be coded anywhere. 65) How do you add a number to a macro variable?

66) If you need the value of a variable rather than the variable itself, what would you use to load the value to a macro variable? 67) Can you execute a macro within a macro? Describe. 68) Can you a macro within another macro? If so, how would SAS know where the current macro ended and the new one began? 69) How are parameters passed to a macro? Re: Important SAS Interview Questions How to determine the executing program name and path programatically: Oftentimes, I was asked to keep the name and path of the executing program in the FOOTNOTE of the generated table or listings.I have always created a macro variable using the %let statement and, then I called the Macro variable in the footnote statement to get the name of the program. Eventhough it is simple.. it may not be suitable when we write application which need to self document... http://studysas.blogspot.com/2009/04/how-to-determine-executing-program-name.html ________________________________________________________________________________ How to check if a variable exist or not: In SAS sometimes, we need to check whether the variable is exist in the dataset or not, we usually run the proc contents program and physically check if the variable exist in the dataset or not.If we want to check it programmatically, then use the following code.... http://studysas.blogspot.com/2009/04/how-to-check-ifvariable-exists-in-sas.html _______________________________________________________________________________ How to check if the File is exist or not in SAS: Guys Let me try explaining how to check if the file exist in the library or directory using SAS.Here I am writing a macro to check if the file exist in the directory or not.Here is the way to check it http://studysas.blogspot.com/2009/04/how-to-check-if-file-is-exist-or-not-in.html _________________________________________________________________________________ SAS programming errors we make..... can be deadly sometimes The errors I will list here will be very few in number. They are errors that you will likely make at some time if you do not remain alert. These errors could have serious consequences so that is why I have described them as "deadly errors". http://studysas.blogspot.com/2009/03/sas-programming-errors-we-made-can-be.html _________________________________________________________________________________ Proc Sort NODUP vs NODUPKEY Somany times people from my orkut community asked me what is the real difference between the Proc sort Dodup and the Proc Sort nodupkey. I always wanted to answer the question in a better way. and folkes here is the answer ..... A common interview question for SAS jobs is "What is the difference between proc sort nodup and proc sort nodupkey?". The answer the interviewer is expecting is usually "proc sort nodup gets rid of duplicate records with the same sort key but proc sort nodupkey gets rid of other records with the same sort key". However, this is not correct. http://studysas.blogspot.com/2009/03/proc-sort-nodup-vsnodupkey.html

__________________________________________________________________________________ PROC TRANSPOSE: How to Convert Variables(columns) into Observations(ROWS) and Observations(ROWS) into Variables(Columns) During my early days as a SAS programmer, I get confused very easily with PROC TRANSPOSE. I mean, I get confused with what are the variables that I need to include in BY statement and ID statement as well as in VAR statement. http://studysas.blogspot.com/2009/03/proc-transpose-how-to-convert.html _________________________________________________________________________________ Displaying the Graphs (Bar charts) using PROC GCHART in SAS Displaying the Graphs (Bar charts) using PROC GCHART in SAS :Just a day ago, I have received a question on Graphs in my orkut community, which prompted me to create following examples.Below are 5 different types of Graphs were produced (including 3d graphs) using Proc Gchart. http://studysas.blogspot.com/2009/03/displaying-graphs-bar-charts-using-proc.html ________________________________________________________________________________ Change all missing values of all variables into zeros/putting zeros in place of missing values for variables I always wondered how do I convert missing values for all the variables into zeros and In this example the I have used array to do the same. The variable list includes ID and Score1 to score6.Using simple array method we can change all the missing value for the variables score1 to score6 to 0. http://studysas.blogspot.com/2009/03/change-all-missing-values-of-all.html _________________________________________________________________________________ How to Save LOG file in the required location: Here is the simple code which allows us to save the log file in the required location. Use Proc printto procedure to save or print the log file. filename dsn C:\Documents and Settings\zzzzzzzzzzzz\Desktop\LOGfile.lst' http://studysas.blogspot.com/2009/03/how-to-save-log-file-or-what-is-proc.html ____________________________________________________________________________________ Calculating group totals and the counts within each group Sample 25217: Calculating group totals and the counts within each group This example uses the SUM() function to sum the AMOUNT column, creating a new column named GRPTOTAL with a COMMA10. format. The COUNT() function counts the number of occurrences of STATE within each group. The GROUP BY clause collapses multiple rows for each group into one row per group, containing STATE, GRPTOTAL and the COUNT. http://studysas.blogspot.com/2009/03/calculating-group-totals-and-counts.html ____________________________________________________________________________________ How to customize page numbers in RTF output In SAS 9.1, are there easier ways to customize page numbers in RTF output? Yes, beginning with SAS 9.1, page numbers can be customized in the RTF destination by using an escape character and the {thispage} function, {lastpage} function, {pageof} function, or all three: http://studysas.blogspot.com/2009/03/how-to-customize-page-numbers-in-rtf.html

____________________________________________________________________________________ How to calculate number of years and number of days between 2 dates; How to calculate number of years and number of days between 2 dates;Exploring the yrdif and datdif functions in SAS as well as INTCK function:There are several ways to calculate the number of years between two dates and out of all the methods, YRDIF function results the most accurate value. http://studysas.blogspot.com/2009/03/how-to-calculate-number-of-years-and.html ___________________________________________________________________________________ How to create a comma separated file (.csv) of a SAS dataset? IN SAS programming, we often require outputting the dataset in different formats like EXCEL and CSV etc and here are the five different ways to export the SAS dataset into .csv file. http://studysas.blogspot.com/2009/02/how-to-create-comma-separated-file-csv.html ____________________________________________________________________________________ How to Import Excel files into SAS Microsoft Excel spreadsheets can be read from SAS in several ways. Two of these will be demonstrated here. First, PROC IMPORT allows direct access to Excel files through SAS/Access to PC File Formats or access to Comma-Separated (CSV) files through Base SAS. The second method uses the Excel LIBNAME engine. http://studysas.blogspot.com/2009/02/how-to-import-excel-files-into-sas.html __________________________________________________________________________________ How to store a number more than 8 digits for a numeric variables Q&A: numeric variables length more than 8? We all know that the default length of the numeric variables in SAS is 8 and if suppose I want to store a number lets say (12345678910, which has a length 11 to numeric variable) to variable total, what should I do? http://studysas.blogspot.com/2009/02/how-to-store-numbermore-than-8-digits.html ___________________________________________________________________________________ Options VALIDVARNAME=UPCASE VALIDVARNAME= V7 UPCASE ANYVALIDVARNAME= option is generally used in SAS whenever we want to control the SAS variable names in the dataset. http://studysas.blogspot.com/2009/02/optionsvalidvarnameupcase.html ___________________________________________________________________________________ How to merge data sets with a common variable? Here is the simple way of merging the data sets with a common variable if the datasets has the same prefix name.For example: col1-col10, dsn1-dsn 7 , or data1 to data10 with common variable of ID.Considering we have 10 datsets and all of them having the same prefix data; http://studysas.blogspot.com/2009/02/mergingdata-sets-with-common-variable.html _____________________________________________________________________________________ Merging the data sets with a common variable if the datasets has the same prefix name?

For example: col1-col10 dsn1-dsn 7 data1 to data6 with common variable of Usubjid.here is the example, I have 7 datasets i need to merge and each of them having the common variable(usubjid) to merge, and all the datasets having the same prefix dsn(dsn1 to dsn7). http://studysas.blogspot.com/2009/02/merging-datasets-using-macro-code.html ____________________________________________________________________________________ when to use &,&&,and &&&,how do we distinguish(Multiple Ampersands) and Diff. Between single dot and double dots in macros Here are the 2 important questions always comes up in our minds,(& vs && vs &&& and single dot and double dots) when we are dealing with macros for the first time and here are the answers for them.I did find a very good regarding the above topics in the one of the SAS forums and IAN WHITLOCK explained it very clear. http://studysas.blogspot.com/2009/02/3when-to-use-do-we-distinguishmultiple.html ____________________________________________________________________________________ How can I count number of observations per subject in a data set? We always have this question in mind, while we do the SAS programming and here is the simple answer for that, we just need to use SUM statement and the FIRST.variable in the SET statement and then the RETAIN statement to calculate the observations count per subject. http://studysas.blogspot.com/2009/02/howcan-i-count-number-of-observations.html _____________________________________________________________________________________ How to remove the duplicate observations in the dataset using PROC SQL, DATASTEP/PROC SQL/or PROC SORT etc? Before using a particular step to remove the duplicate observations, we should understand that the duplicate observations are pertaining to the key variables like usubjid, treatment, patientno. etc, which are unique or exact duplicates( 2 or more observations has the duplicates with respect to all the variables in the dataset).If the observations are exact duplicates with respect to all the variables in the dataset, we can remove the exact duplicates by: http://studysas.blogspot.com/2009/02/how-to-remove-duplicate-observations.html _____________________________________________________________________________________ How to scan more than 20 records to determine variable attributes in EFI: In Versions 7 and 8 of the SAS System, by default the Import Wizard, PROC IMPORT and the External File Interface (EFI) scan 20 records to determine variable attributes when reading delimited text files.Changing the default setting can only be done for EFI in Version 7, Release 8 and Release 8.1. Beginning in Release 8.2 changing t he default setting is applicable to the Import Wizard, PROC IMPORT and EFI. http://studysas.blogspot.com/2009/02/how-to-scan-more-than-20-records-to.html _____________________________________________________________________________________ Macro for sorting the variables: How to convert character date values into numeric date values using DATASTEP/PROC SQL and ARRAYS: How to detect missing values using Arrays: First. & Last. Variables: How to determine the last observation in the dataset:

How to determine whether a numeric or character value exists within a group of variables: Lag Function: How to obtain information from the previous observation: How to create a new dataset from multiple datasets based on the sorted order: Dynamically generate SET statement to combine multiple datasets: How to determine which dataset contributed an observation: How to determine if a variable exists in a dataset or not: How to Read Delimited Text Files into SAS: How to keep only even number observations in the dataset: How to verify the existence of an external file: Accurately calculating age in one line code: How to use INDEX/INDEXC functions: Finding the number of observations in the dataset: How to capitalize first letter of the every word:/ PROPCASE FUNCTION: How to use the SCAN function: Concatenation functions in SAS 9.0: SOUNDEX Function: IFC and IFN functions:new IF functions & IF-THEN-ELSE vs SELECT: How to remove the duplicate observations from the dataset using PROC SQL, DATASTEP/PROC SQL/or PROC SORT approaches ? How can I count number of observations per subject in a data set? How to save the log file or what is PROC PRINTTO procedure How to calculate number of years and number of days between 2 dates; How to customize page numbers in RTF output How to create a comma separated file (.csv) of a SAS dataset? Change all missing values of all variables into zeros/putting zeros in place of missing values for variables ____________________________________________________________________ Base SAS Certification Summary---Functions: SAS Functions can be used to convert data and to manipulate the values of character variables. Functions are written by specifying the function name, then it's arguments in parentheses. Arguments can include variables, constants, or expressions. Although arguments are typically separated by commas, they can also be specified as variable lists or arrays. http://studysas.blogspot.com/2009/01/base-sas-certification-summary.html ____________________________________________________________________________________

http://studysas.blogspot.com/2008/11/sas-certification-assignments.html _____________________________________________________________________________ HOW TO CREATE A SAS TRANSPORT(XPT) FILE http://studysas.blogspot.com/2008/12/how-to-create-transport-file.html ______________________________________________________________________ How to Debug the SAS code: Question:I have a huge SAS program that isn't working. The results I get are not right but there are no errors or warnings in the SAS log. How can I figure out where I went wrong? http://studysas.blogspot.com/2008/11/how-to-debug-sas-code.html how to import XTP files into SAS datasets? 7 Barclays WHAT IS SAS WEB SERVICE and what are the steps to create an xml service ? 181 Satyam what is null hypothesis? why do you consider that? 146 Accenture whenever we using the merging through data set merging ,we can get note in log like this "MERGE STATEMENT HAS MORE THAN ONE ONE DATASET BY REPEATED BY VAIABLES" but the output has come in good manner,whenever in in sql(full join) we can get cartion product.so How do overcome this problem in sql? 111 Accenture What is your favorite all time computer book? Why? 249 Oracle Of all your work, where have you been the most successful? 389 Oracle How necessary is it to be creative in your work? 186 Oracle Hello, I have PROC SQLs results group by 3 fields and I use SUM and COUNT functions in SQL. The problem is when I try to display my result with PROC TABULATE. I am getting very big numbers. I believe I make a mistake some where in Tabulate. Here is my Proc Tabulate. PROC TABULATE DATA=OUT04_05 FORMAT=12.; CLASS YR CENTRE VISA / PRELOADFMT EXCLUSIVE; VAR NEWUSER FRAUD TRANSFER AUTUSER REISSUE; TABLE CENTRE ALL, (YR ALL)*VISA, (NEWUSER*F=COMMA12. AUTUSER*F=COMMA12. FRAUD*F=COMMA12. TRANSFER*F=COMMA12. REISSUE*F=COMMA12.) / MISSTEXT={LABEL='0'} PRINTMISS RTS=20; FORMAT VISA VISAFMT.; KEYLABEL SUM = ' ' ALL = 'TOTAL'; LABEL YR = 'DATE YEAR' NEWUSER = 'TOTAL NEW ACCT' TRANSFER = 'TOTAL TRANSFER' FRAUD = 'TOTAL FRAUD TRANSFER' AUTUSER = 'TOTAL AUTH USERS' REISSUE = 'TOTAL REISSUE'; When I code it like : NEWUSER*N*F=COMMA12. AUTUSER*N*F=COMMA12. I get same amount numbers but to find a NEWUSER I use COUNT(*) and to find AUTUSER I use SUM(xxxx) function so both result shouldnt be the same my problem is in this point. Could you tell me where the problem in code is. How can I display my result? TX. 300 what is study design in while working with SAS? what are screening variables in SAS? 69 What are the difficulties u faced while doing vital signs table or dataset? 135 what is information maps? 184 CitiGroup /* This is example of age caluculate wihtout to display perfect days and years in output window */ data age; retain dob "12jun2003"d now "24may2011"d; age1=now-dob; age=(now-dob)/365.25; years=int(age); days1=round((age-years)*365.25); months=month(now)-1; if days1 gt 30 and months in(12,10,8,6,4,2)then do;

month1=days1/30.4375; month=int(days1/30.4375); if day(now)=1 then days=1; else days=round((month1month)*30.4375)+1; drop days1 month1 month; end; else if days1 gt 30 and months in (1,3,5,7,9,11)then do; month1=days1/30.4375; month=int(days1/30.4375); if day(now)=1 then days=1; else days=round((month1month) *30.4375); drop days1 month1 month; end; drop age age1; proc print data=age; format dob now date.; run; Emerio 1 81 1 new york 7,262,700 2 los angeles 3,259,340 3 philadelphia 1,642,900 how to read the above data using input statement consider the above data is in txt format externally u have to use infile and input statement. Quintiles 6 205 How to get the repeated values by using sql in sas ? 0 59 what is the difference between proc means and proc summary? Accenture 2 195 duplicates by using proc sql? Genpact 1 344 how to remove the duplicates by proc sql? Genpact 1 214 How can I remove header from output data set? 0 71 what is ae onset date n what is RDS Accenture 0 58 i have a data set with 20 observations i want label from 8 to 15 observations ? how you create this one. CTS 4 636 What is criteria for adverse events and treatment-emergent adverse events? Accenture Why do we use QUIT commmand for proc datasets and proc sql ??? 2 461 it will become easy if uuu provide website linkssss and list of consultanciessssss 0 56 Do we follow ADAM in analysis dataset development?How? Usually which version? Why is it necessary? How to get any kind of data in SAS? Is it possible to take data from notepad in SAS? GSK How to convert .xls file into CSV format? Quintiles What are types of transport files? Quintiles which stats created by proc means that are not created by proc summary or vice versa? GSK how to handle in stream data containing semicolon in it? what is study design in while working with SAS? what are screening variables in SAS? what is in stream data in SAS? What is instream data in SAS? Can you calculate the mean, median and mode of the following data set using data step logic? Don't use any function or procedure. data a; input age @@; datalines; 22 32 32 32 43 23 24 56 45 54 28 29 27 26 25 28 30 20 18 37 36 47 46 56 19 20 ; run; I have calculated the mean which i have posted in the answer section. HSBC How do you convert basic cube to transaction cube and transaction cube to basic cube? what is syntax of proc merge ? TCS how to delete the

Which is the best training Institute for SAS Business Intelligence course? Hi, I need to create a SAS Map of USA using SAS Graphs(Proc Gmap).The data i have dosent contain any coordinates of USA cities or counties or states, and the zip codes are diffrent in the data i have from the zip code in the Maps.US dataset in the Maps Library for SAS MAPS. the data i have is a sales report. i have to generate the maps according to the states,cities aligned in the sales data, HELP Appriciated What is SAS? is it a software just for use or we can creat something over there? Cognizent what is difference in window SAS & Unix SAS.....how do define working environment in both??? JPMorganChase How will you use the WHO Drug Dictionary for Reporting Clinical Trials? Do you need to rearrange the order of the data for the report? Do you need to compute new variables? If so,should you do this before you execute the report-writing procedure? 0 61 Do you need to combine data sets? How should you combine data sets MERGE or SET statements in DATA steps,PROC APPEND,PROC SQL? Is the physical structure of the data set in the same orientation as the report? Do you need to reshape the data sets? What method should you use to reshape the dataDATA steps,PROC TRANSPOSE,output data set from a procedure? How are the analysis data sets structured? What data sets do you need to produce the report? Novartis what is the difference between proc means and proc tabulate? CTS which domain is better in sas? clinical trails or banking I need help in merging two different datasets. I am merging by date and I want to propagate observations from one dataset to the corresponding dates. One dataset has a unique date for each day of the month, while the other dataset has same date for different patient visits. For example I want to spread an observation on the 31DEC2008 from one dataset to several observations with the same date on a second dataset for all the patients who visited on that date. I have tried to merge the two and the result is not what I wanted. Instead I get a dataset whereby all the dates have missing values where observations from the first datset should have spread. how can u convert this 25-jul-2010 from numeric to charcter? Tell different ways to create Macrovarible? Accenture How to convert HTML file into SAS dataset? whenever we using the merging through data set merging ,we can get note in log like this "MERGE STATEMENT HAS MORE THAN ONE ONE DATASET BY REPEATED BY VAIABLES" but the output has come in good manner,whenever in in sql(full join) we can get cartion product.so How do overcome this problem in sql? Accenture 0 how do i get last 10obs from a dataset when we don't know about the number of obsevations in that dataset? TCS

I have a SCD Type 2 Dimention for Location In which A Sales Office in Having two Surrogate Keys just because of the change in it's Sales Group. SKey SalesGroup Sales Office BeginDate EndDate 280 SG1 SO1 01APR2000 01APR2010 281 SG2 SO1 02APR2010 31MAR2999 Now while loading the Fact, the Lookup ir returning SKey 280 for records before and after 01APR2010. I am not able to give WHERE condition in the Lookup Properties (TranDate between BeginDate and EndDate). what are the different ways of merging two datasets.name atleast 4. Hot to suppress characters from a given string? CTS How to write duplicate records into a separate dataset using sort? HSBC How can you get the single data set from the library(which has the number of data sets)? Accenture Why Info School? BUILD YOUR CAREER WITH RIGHT GUIDANCE AND SUPPORT Why Info School? BUILD YOUR CAREER WITH RIGHT GUIDANCE AND SUPPORT SAS Training in Data Management at InfoSchool Bangalore How to import multiple xls files into sas. Out of those files, how to get different values from a single variable and how to find number of rows per value type? //We can do this using group by for one xls file with proc sql. Was wondering how I can achieve this for multiple files at the same time. Any ideas? What is proc sql pass through facility? L&T The below code we are using for creating more than one macro variables in proc sql using into clause. How we can use same code to create macro variables vara, varb, varc instead of var1, var2, var3.? proc sql noprint; select count(distinct(patient)) into :var1 - :var3 from dataset1 group by trtreg1c ; quit; Accenture Write SAS codes to compare two datasets. Suppose the allowable difference is 0.1. Write a SAS macro to calculate number of numbers in an email address. When merging 2 datasets with a common variable (not merge key), how to keep both? Please write codes to merge two datasets and keep every record in the first dataset. You need to perform an analysis on a massive dataset by groups, but are unable to sort the data due to memory constraint. How would you accomplish the task? What is LOGICAL VARIABLES in SAS.And how it can be used..Can anyone support..??? You need to create an In List that it is to be later used in a Where Clause that includes all the Regions that begin with the letter A from the sashelp.shoes table. Using PROC SQL with an into clause create the following string from the sashelp.shoes table using the variable region AFRICA,ASIA,.. What happens in the following code, if u type 8 instead of *? proc sql noprint; create table abc as select 8 from lib.abc; quit; What are the difficulties u faced while doing vital signs table or dataset?

We have a string like this "kannafromsalembut" ,from this i want to get only "fromsal" (but one condition with out using substring function)here we can not use scan because in the given string there is no delimeter? so give ans without out using substring ? How to get part of string form the source string without using sub string function in SAS? how to read character value without using substr function in sas ? proc means? proc sort? proc append? proc freq? proc print? proc content? Oracle What is the order of evaluation of the comparison && logical && relational operators:? CitiGroup PROC SQL always ends with QUIT statement.Why cant you use RUN in PROQ SQL ? HP What is shift table? have you ever created shift that? Accenture What are the rows present in protocol Violation table? Accenture What are all the problems you faced while validating tables and reports? Accenture What are TEAEs Accenture How do you validate tables abd reports? Accenture What procedure you used to calculate p-value? Accenture What are the efficacy variables in your study? Accenture Baseline definition in your study Accenture What kind of variables are collected in AE dataset? Accenture What are the considerations when picking a SAS/STAT procedure? Accenture How do you derive descriptive statistics? Accenture What is chi-square test? have you used that? Accenture What is null hypothesis? why do you consider that? Accenture What is p-value? Accenture What is the Population you used in your project, is it ITT or PP? Accenture For report generation which one you used proc report or data_null_? Accenture In proc transpose and data step with arrays which one you pick? Accenture Did you used proc lifetest? when? Accenture Did you used proc test? when? Accenture What are all the reports you generated in your recent project? Accenture What is the primary variable in your study? Accenture How the Excel file enter into the SAS environment without Code of Infile & Import procs,if i have no file Conversion? Reddy-Labs

How to get second top scorer student from a class- table having different sections A, B, C & D? each section has same number of student. How to get top scorer student from a class-table having different sections A,B, C & D? Each section having same number of students. What are Dashboard reports?And significance of these in analysis? How to get second highest salary from a employee table and how get a 5th highest salary from a employee table? ABC Which is the best place to learn SAS clinicals and Oracle clinical in hyderabad? What is prime numbers? how we can get plc write sas code? Icon You have a data set of 100 observations,how can you restrict the output so that the output has only data from row no. 10 to row no. 20 How to extract data from SAP servers? Is like oracle servers or any other methods to extract please reply me. If we dont want to print output what we have to do..???give syntax..??? GSK-GlaxoSmithKline What type of reports you are generating in your company...??? GSK-GlaxoSmithKline What type of tables you are using in YOUR reporting..??? GSK-GlaxoSmithKline What are all the default values getting in PROC MEANS...??? What are all the ways to define macro variable?? GSK-GlaxoSmithKline Is it possible to generate sas datasets using proc print ??? GSK-GlaxoSmithKline If i having variables named a b c d e f ,how to find total of each variable ????give syntax...?? Accenture What cause the "error: connect:" and "error in the libname statement" when there weren't any such problems? Hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also? Pfizer Hi tell be about pfizer? how to compare the work with other companies ? please tell me how to login and work also? Pfizer How to Rename Library? What is Transaction...? And what are Comment, Roll back n Save point..? What is difference between Global n Local Macro Variables..? TCS What is Tabulate.Why we use it.? Which type of output we get from Tabulate.? TCS What are the functions done while Compilation...? TCS One way of creating a new variable in Macros is by % Let....What is the other way..? TCS In which format does Date stores in sas..? What is the use of DATE in SAS.? TCS

What are symbol tables? Difference between Local N Global Symbol tables..... TCS What r all the reporting procedures...? What is univariate n where it can be used n how...? What are exact SAS Base contents..?N what r SAS Tools..? How many versions came upto now in SAS? CTS data abc; input x y ; cards; 1 2 5 6 7 8 7 8 1 7 5 7 ; run; Proc Freq data=abc; tables x*y / chisq nopercent nocol norow PLCORR; RUN; If we run the code, we have Polychoric Correlation = 0.9054 in the last table. I want to extract this particular entry with the value. Means I will create one dataset in which this value will be stored/extracted. I need your help in coding this. Please help me out. 2 612 Which is the best training institute for SAS in Delhi. Please reply HCL is QUALCOMM using SAS ? How do you add a prefix to some or all variables in a dataset using a SAS macro? How do you download a flat file from Mainframe to your local PC using SAS? What are the methods that you would employ to fine tune your SQL extract process using SAS/Access or Proc SQL? Name few built in sas transformation in DI studio ? SAS WHAT IS SAS WEB SERVICE and what are the steps to create an xml service? Satyam What are system option ? Give few examples ? What are dataset options and dataset statements ? if there is a keep option and keep statement ? which one is executed first ? Difference between a WHERE statement and IF statement? What is the advantage of using WHERE statement option on the dataset? Satyam What is SAS ACCESS AND SAS CONNECT? Give an example and data statements used. TCS HOW DO WE CREATE A SAS STORED PROCESS IN SAS EG? TCS What is incremental update? is this possible in SAS OLAP CUBE STUDIO. TCS What are different types of sas servers? On which server does the sas code execute? TCS What is SAS Information Map Studio and its purpose? TCS How does sas know on which server the piece of code to be executed? Say if a proc olap code is written then how the sas application would detect on which server to execute. TCS How can a SAS WEB REPORT STUDIO USER identify which report tabs they have been permitted without entering the SAS WEB REPORT STUDIO TCS 2 575 Which are SAS Windows Clients & SAS Java Clients TCS We want to merge file A and B. File A has variable age, file B provide birthdate. How to merge the data according to age in file B

What are the joins,types of joins and thier functions? SAS In the SAS Data step what is the difference between the subsetting done by Where and subsetting done by If? Cognizent Does anybody has lastest SAS certification dumps,if anybody has please mail me on saggydesai@gmail.com What is the difference between SAS Data step and SAS PROC SQL, and which is better? What is difference between sas rename and lable? What is PhaseIII, ODS, TLG, Macro and Proc in SAS 0 300 MERGE? Accenture What is the difference Assumptions/Conditions? between Regression and what is Difference between PROC SQL JOINS and

Logistic

Regression?

Can

explain

the

How to perform paired t-test using Base/SAS & SAS/Stat? How do i read multiple spaces in datasets? How to do user inputs and command line arguments in SAS? D&B BoA There are 200 observations in a dataset, i want to pull out the observation no's 100, 150,180,190 by using Proc SQL? How you can get it? Hi I have list of products in a dataset, which are classified by other name for eg:- there is a product A> Malambo Shiraz Malbec 750ML(0388) which is a Red wine.Now i need to generate a report where it shows if this product appears then it should b displayed as red wine,similarly for other products and other classification. I dont wan use proc format. Symphony How to convert a given date value into SAS date CitiGroup What is the difference between Proc tabulate and Proc print CitiGroup data study; input Subj : $3. Group : $1. Dose : $4. Weight : $8. Subgroup; x= input(Weight,5.1); datalines; 001 A Low 220 2 002 A High 90 1 003 B Low 193.6 1 004 B High 165 2 005 A Low 123.4 1 ; Why does X get truncated? X shows up as 22 instead of 220,9 instead of 90 and 19.8 instead of 198? This problem doesnt happen with the values 193.6 and 123.4. This does not happen if x is read on the 5. informat instead of the 5.1 informat 2 566 In this question, I rename the numeric variable phone to numphone and then try use phone=put(numphone,comma16.) to store the numeric value numphone as a string value in phone. But I get a warning tha numphone already exists and in the data sat phone doesnt exist and numphone is set to missing. Why? data names_and_more; input Name $20. Phone : comma16. Height & $10. Mixed & $8.; Name = tranwrd(Name,' ',' '); rename phone = numphone; phone = put(numphone,comma16.); datalines; Roger Cody 9,087,821,234 5ft. 10in. 50 1/8 Thomas Jefferson 3,158,488,484 6ft. 1in. 23 1/2 Marco Polo 8,001,234,567 5Ft. 6in. 40 Brian Watson 5,183,551,766 5ft. 10in 89 3/4 Michael DeMarco 4,452,322,233 6ft. 76 1/3 ; 1 506 If you set a label in the data step and call a proc freq on the data, how do you display the data without the labels and just the variables? I use NOCUM/NOPERCENT option in the tables statement like this Proc freq data = deepak; tables x y /nocum nopercent; run; Here I get nopercent and nocum in the output only for variables x and y. How do i do it for all variables? Deepak

I have 2 data sets A & B. Both have a variable called Age in them, each of them specifying a different functionality. In my program I use bot these data sets. How do I specify which Age variable I want to use? 3 910 data voter; input Age Party : $1. (Ques1-Ques4)($1. + 1); datalines; 23 D 1 1 2 2 45 R 5 5 4 1 67 D 2 4 3 3 39 R 4 4 4 4 19 D 2 1 2 1 75 D 3 3 2 3 57 R 4 3 4 4 ; Idont understand what the (Ques1-Ques4)($1. + 1) means. I have seen (Ques1-Ques4)(4*$1.), but what is (Ques1-Ques4)($1. + 1)? libname deepak 'C:\SAS Files'; proc format; invalue convert 'A+' = 100 'A' = 96 'A-' = 92 'B+' = 88 'B' = 84 'B-' = 80 'C+' = 76 'C' = 72 'F' = 65; data deepak.grades; input ID $3. Grade convert.; *format Grade convert. ; datalines; 001 A- 002 B+ 003 F 004 C+ 005 A ; proc print data = deepak.grades; run; I get the following output Obs ID Grade 1 001 . 2 002 . 3 003 . 4 004 . 5 005 . I dont understand why Grade shows up as a missing value. Everything seems fine, including ID $3. Now, in case I use ID : $3. Or use column input, I get the desired output. Kindly help What would the following datastep do? Data _null_; Set Dist end=eof; Call Symput("xx"!!left(put(_n_,2.)),&dimension); If EOF then Call Symput('numrows',left(put(_n_,2.))); Run; dimension is a macro variable that is being passed here How to import the Zip files into SAS? If it is possible in SAS? If it is posible write the code... a clinical sas programmer write the code and after successful execution where do they store it. how they submit tables to TL how work is assigned to programmers either both code, log, output to be submitted. can any one tell me the process HSBC data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also. 1 882 data data1; input dt account; format dt date9.; cards; 1745 1230 1756 1120 1788 1130 1767 1240 ; data data2; input startdt enddt total; format startdt date9. enddt date9.; cards; 1657 1834 12300 1557 1758 16800 1789 1789 12300 1788 1345 12383 1899 1899 13250 ; proc sql; create table data3 as select * from data1 as x left join data2 as y on x.dt>=y.startdt and x.dt<=y.enddt; quit; Here, we are getting cartision product. But,I want left join report consisting of this program. It should not get duplicate values. you can modify the program also. 0 282 what is the frontend and backend of sas? Is sas is a progaming langauge or tool? on which langauge sas depends? WHAT IS DEBUGGING? HOW TO TEST THE DEBUGGING IN SAS? Accenture Why is the use of Retrive statement and give me with example? ME What is the difference between sas and other datawarehousing languages?what are the advantages of sas over them? Accenture data abc; input s w k g o t a m; cards; 1 2 3 4 5 6 7 8 2 3 4 5 6 7 8 9 ; run; i want the output to be the sorted order(only variables).observations should not be changed.. What does a PROC TRANSPOSE do? Accenture What report output formats can you generate using SAS? Accenture What is the difference between a PROC step and a DATA step? Accenture What does error:1 mean? Accenture

CHOOSE ANY ONE OF THE PROCEDURE FOLLOWING TO GENERATE THE REPORTS? HOW CAN YOU SAY IT IS BETTER THAN THE OTHER? AND DEFERENCIATE THESE TWO ? 1). REPORT PROCEDURE 2). TABULATE PROCEDURE CybAge HOW MANY WAYS YOU CAN RETRIEVE THE DATA FROM ORACLE TABLES? WHAT IS ORACLE CLINICAL? HOW IT IS USEFUL? Accenture WHAT IS LAG FUNCTION ? WHERE CAN YOU IMPLEMENT THIS FUNCTION? Zensar how can u join the two tables without using proc sql Joins and nested queries ? IBM wt is a-z and a--z? Accenture how can you improve the performance of a query, If it is excuting very slowly? Zensar how do u validate sas program Accenture define table lookup and how may ways it can be done...explian how do you validate sas program? Accenture What is difference between rename and lable in sas? Satyam what is the difference btw proc means and proc univariate? HSBC how do u test a pros sql(works or not) without executing it? HSBC 1. We can execute a macro with in a macro,by using call symput and symget can any one give me one example? 2.We can create the macro variables by using %let,%do,macro parameters,INTO clause in proc sql and call symput, can any one give me example to create macro variable with INTO clause and call symput? 1. How to draw pivot tables in Excel by using SAS and in which version we can use VB script for to draw pivot tables in Excel? Answer with example data. 2. What are the advantages of _NULL_ in Data steps? Can we use _NULL_ in Proc steps also? 3. How to call the macro variable into Data Steps? 4. Can we draw pivot tables in Excel using Proc SQL? Please post answers for the above questions with suitable examples, and how to use VB script for Excel using SAS. Is there any differnce between proc means and proc summary? What are the differences between proc report and proc tabulate? Is there any difference between proc summary and proc means? 1. What is the difference between _NULL_ , _ALL_, and _N_? 2. What are the uses of _NULL_ using in Data Steps? Can we _NULL_ in Proc Steps also? 3. How do call the macro variable in Data Steps? 4. How to construct Pivot tables in Excel Using SAS? How we can create optional or required parameters in SAS macro... TCS Approximately what date is represented by SAS date value of 730

How the date 04oct1994 is stored in SAS,not only give the answer explain in brief? How to intersect the tables by using PROC MIXED? CitiGroup What are information maps? CitiGroup What is OLAP? CitiGroup How to write code for left outer join in SAs using datastep? CitiGroup Describe about joins, briefly. CitiGroup How to assign a macro value to a variable? CitiGroup What is Global Symbol table and Local symbol table? CitiGroup Tell me about intnx, intcx functions? CitiGroup What is the need of INDEX in datasets? CitiGroup How would you remove a format that has been permanently associated with a variable? ________________ TCS What is portability of sas programmes? Capital-One In ods is there any lib's SAS What is the diff b/w verification validation in sas SAS 1. How many ways are there to create variables? 2. What is CLM,how can we use it? 3. What are the advontages of data step? 4. What is the extension of editor window in SAS 9.1.3? 5. How do you copy a particular data set from one library to another? 6. What is the use of double option? 7. Advontages of Proc Report? 8. What is the basic use of where statement? 9. How do you terminate the statments in SAS Programming? 10. What is the difference between symput and symget? 11. How would identify the local and global variable? can any one answer for the 4'th question CitiGroup What are methods to identify duplicate observations? HCL If x=round(26.3,10)-1 then x= how much and how explain? BoA What is a macro routine?

What are MIs reports? what is the use of MIS reports and How can u generate the MIS reports in SAS? If anybody know explain with the eg. CitiGroup How did you use the round function?give an example(don't say it will round to the nearest intger) eg1:round(84.55,.1) =84.6 eg2:round(92.64,.1)=92.6,How it is happening like this tell me the logic,that is how the round function works when we have deimal values? BoA If i doest required Cumilative frequency in my table, generated by using PROC FREQ what i had to do? HCL sas implementing companies in pune implementing clinical projects if anyone knows plz send ans immediately What is the pound sign used for the DATA _NULL_? Explain the message MERGE HAS ONE OR MORE DATASETS WITH REPEATS OF BY VARIABLE. How would you combine 3 or more tables with different structures? Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain. Code the MEANS to produce output to be used later. Code a PROC MEANS that shows both summed and averaged output of the data. Name the option to produce a frequency line items rather that a table. There is a field containing a date. It needs to be displayed in the format ddmonyy if its before 1975,dd mon ccyy if its after 1985, and as disco years if its between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT. CTS Which date advances a date, time or date/time value by a given interval? What is the significance of the OF in X=SUM (OF a1-a4, a6, a9);? What is the order of evaluation of the comparison operators: + - * /** ()? Name statements that are execution only. Name statements that function at both compile and execution time. L&T How do you debug macros? Accenture I am having a stored process.it needs to route my report to both hthml and Xls.By default SP routes to html.I used the PRINTTO to route the html to Xls.BUt it createsthe file not but no content was written to file(0KB)?how can i do it? What is the difference between proc report and proc format? CTS DATA ABC; INPUT TDATE DATE9. AVG; CARDS; 18APR2008 150.00 19APR2008 167.00 20APR2008 123.00 21APR2008 145.00 ; RUN HOW CAN I FIND THE DIFFERENCE BETWEEN AVG OF 18APR2008 ANF 21APR2008?? IF ANY ONE GETS IT PLS TRY TO POST IT. Verinon-Technology-Solutions What is difference between (a-z) and (a--z) Accenture What is LAG function?How is it used? can any one explain Verinon-Technology-Solutions IS SAS COMPILER OR INTERPRETER? EXPLAIN? HSBC

sas implimented companies in hyderabad CTS How to read multiple excel sheets from a single excel file at once???? Verinon-Technology-Solutions What are the main differences between sas versions 8.2, 9.0, 9.1? I have 50 variables in one data set, In reports i want to generate every 10 variables in one page how we will write code in proc report. Please, anyone, let me know the style or an example of using 'by='/'by' variable of a PDV(Program Data Vector) Verinon-Technology-Solutions Can anyone help to find a statement to get all the predefined formats? Verinon-Technology-Solutions %STPbegin;%STPEND; ERROR: No logical assign for filename _WEBOUT. WARNING: No body file. HTML output will not be created. unable to fix it.plz help what is sas? is a package or tool? give me introduction about sas? Accenture how to do user inputs and command line arguments in sas? D&B how do i read multiple spaces in datasets? eg: vijaya raghava perumal.I tried with using & but it workss if its vijaya raghava but not for raghava perumal.how to do this? Xansa my problem is to export my report to xsl.i can do that.but the problem is my report has 3 headings first heading should be printed with the merging of (1-5)cells and heading 2 should be of merge(2-4)cells?how to do this condition? Oracle how to shift the rows to cols? eg: i have like field1 field2 field3 10 20 20 this should be displayed as field1 10 field2 20 field3 30 (without the obs col) how do this?can i use transpose or tell me suitable way to do this? CMC what does .. meant in sas macros D&B There is a field containing a date. It needs to be displayed in the format "ddmonyy" if it's before 1975, "dd mon ccyy" if it's after 1985, and as 'Disco Years' if it's between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT D&B In a shcool there are 1000 students. After completion of every test in 6 subjects , each subject teacher submit the marks of every student at different times and loaded in the database commonly. How will you seperate the top two subject marks for each each studet using SAS? how can you code the confidence intervals? Ranbaxy How will you assign all the variables of an dataset into a macro variable separated by a space? For example if a dataset has variables A,B,C. Assign them to a macro variable X as X=A B C Accenture What is the difference between nodup and nodupkey options? iFlex Where will go the observations that were deleted by delete statement? 1 1165 between %put and symbolgen? what is the difference

What is the difference between compiler and interpreter? give any one example (software product) that act as a interpreter? Accenture

How do we get duplicate observations in a separate dataset? CitiGroup Code the tables statement for a single level frequency? Wat is sas? is a package or programming language? Wat has been most common programming mistake? What is TAB delimiter? explain about it? what will you do to get TAB delimiter? How to display duplicated observations in a data using base sas. HCL What is the main difference between rename and label? (don't say that they both perform the same function). Parexel What is picture format? give any one example? Parexel What are the new features included in the new version of SAS i.e., SAS9.1.3? Wockhardt What are the advantages of using SAS in clinical data mangement? why should not we use other software products in managing clinical data? Wockhardt How do we mail reports from SAS environment to our team leader Wockhardt What is pdv? how it is related to input buffer in sas? Satyam 5 5447 step? Allianz how we can call macros with in data

Hello, I have PROC SQLs results group by 3 fields and I use SUM and COUNT functions in SQL. The problem is when I try to display my result with PROC TABULATE. I am getting very big numbers. I believe I make a mistake some where in Tabulate. Here is my Proc Tabulate. PROC TABULATE DATA=OUT04_05 FORMAT=12.; CLASS YR CENTRE VISA / PRELOADFMT EXCLUSIVE; VAR NEWUSER FRAUD TRANSFER AUTUSER REISSUE; TABLE CENTRE ALL, (YR ALL)*VISA, (NEWUSER*F=COMMA12. AUTUSER*F=COMMA12. FRAUD*F=COMMA12. TRANSFER*F=COMMA12. REISSUE*F=COMMA12.) / MISSTEXT={LABEL='0'} PRINTMISS RTS=20; FORMAT VISA VISAFMT.; KEYLABEL SUM = ' ' ALL = 'TOTAL'; LABEL YR = 'DATE YEAR' NEWUSER = 'TOTAL NEW ACCT' TRANSFER = 'TOTAL TRANSFER' FRAUD = 'TOTAL FRAUD TRANSFER' AUTUSER = 'TOTAL AUTH USERS' REISSUE = 'TOTAL REISSUE'; When I code it like : NEWUSER*N*F=COMMA12. AUTUSER*N*F=COMMA12. I get same amount numbers but to find a NEWUSER I use COUNT(*) and to find AUTUSER I use SUM(xxxx) function so both result shouldnt be the same my problem is in this point. Could you tell me where the problem in code is. How can I display my result? TX. WHAT DIFFERRENCE DID YOU FIND AMONG VERSION 6 8 AND 9 OF SAS. Genzyme How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? How do you test for missing values? How would you create multiple observations from a single observation? What are some good SAS programming practices for processing very large data sets? Briefly describe 5 ways to do a "table lookup" in SAS. Why is SAS considered self-documenting? Are you sensitive to code walk-throughs, peer review, or QC review?

What other SAS features do you use for error trapping and data validation? How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs? How could you generate test data with no input data? What is _n_? Accenture In the flow of DATA step processing, what is the first action in a typical DATA Step? Accenture Name statements that are execution only. Accenture Name statements that function at both compile and execution time. Accenture Identify statements whose placement in the DATA step is critical. Accenture Name statements that are recognized at compile time only? Accenture At compile time when a SAS data set is read, what items are created? Accenture Does SAS Translate (compile) or does it Interpret? Explain. Accenture What is the Program Data Vector (PDV)? What are its functions? Accenture How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set. Accenture How would you code a merge that will keep only the observations that have matches from both sets. Accenture How would you delete observations with duplicate keys? Accenture How would you delete duplicate observations? Accenture Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables. Accenture If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables? Accenture When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? Accenture How would you include common or reuse code to be processed along with your statements? Accenture Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself. Accenture What is the one statement to set the criteria of data that can be coded in any step? Accenture If you do not want any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? Accenture

If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? Accenture Describe the function and untility of the most difficult SAS macro that you have written. Describe a time when you were really stuck on a problem and how you solved it? Can you use a macro within another macro? If so how would SAS know where the current acro ended and the new one began? Can you excute a macro within a macro? Describe. If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable? How do you add a number to a macro variable? What do you feel about hardcoding? Are you involved in writing the inferential analysis plan? Tables specfications? Tell e how how dealt with.. Give e an example of.. Describe the function and untility of the most difficult SAS macro that you have written. Describe a time when you were really stuck on a problem and how you solved it? DELL Can you use a macro within another macro? If so how would SAS know where the current acro ended and the new one began? Can you excute a macro within a macro? Describe. Genta If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable? How do you add a number to a macro variable? How would you code a macro statement to produce information on the SAS log? This statement can be coded anywhere. Describe how you would pass data to macro. What is the purpose of using the N=PS option? Oracle How do you generate random samples? How would you generate 1000 observations from a normal distribution with a mean of 50 and standard deviation of 20. How would you use PROC CHART to look at the distribution? Describe the shape of the distribution. Explain the message 'Merge has one or more datasets with repeats of by variables'. How would you keep from overlaying the a SAS set with its sorted version?

Which date functions advances a date time or date/time value by agiven interval? What has been your most common programming mistake? Wipro What other SAS features do you use for error trapping and data validation? Are you sensitive to code walk-throughs peer review or QC review? How can you put a "trace" in your program? If you were told to create many records from one record show how you would do this using arrays and with PROC TRANSPOSE? HCL Briefly describe 5 ways to do a "table lookup" in sas. How would you remove a format that has been permanently associated with a variables? Why is a STOP statement needed for the point=option on a SET statement? How would you include common or reuse to be processed along with your statements? How would you determine how far down on a page you have printed in order to print out footnotes? For what purpose(s) would use the RETURN statement? What is the pound sign used for in the data_null_ ? What is Business Intelligence? CitiGroup How can u extract,transform and loading? CitiGroup How can u import .csv file in to SAS?tell Syntax? CitiGroup What is the use of proc sql? CitiGroup What is SAS/Graph? CitiGroup How can u create zero observation dataset? CitiGroup What is the diff. b/w proc means and proc summary? CitiGroup What is Enterprise Guide?what is the use of it? CitiGroup How many types of MERGE? CitiGroup What is SAS/Access and SAS/Connect?what are the uses? What is the difference between SET and MERGE? CitiGroup What are input dataset and output dataset options? HCL What are scrubing procedures in SAS? Oracle 1 2070 what is fact table and factless table? What are the validation tools in sas? TCS What other SAS features do you use for error trapping and data validation?

What are some good SAS programming practices for processing very large data sets? How could you generate test data with no input data? How do u identify a macro variable How do you read binary data in sas? Satyam Can Some one Explain How the Datasets from SAS can be loaded in to the MVS OS? HCL Can we replace a dataset into view? CliniRx What is the SAS/ACCESS and SAS/CONNECT? TCS What is the difference between the SAS v8 and SAS v9? TCS How we will Developing new reports Using Data step programming and Macros ? What is _n_? In the flow of DATA step processing, what is the first action in a typical DATA Step? Name statements that are execution only? Name statements that function at both compile and execution time? Identify statements whose placement in the DATA step is critical? Name statements that are recognized at compile time only? At compile time when a SAS data set is read, what items are created? Does SAS? Translate? (compile) or does it ?Interpret?? Explain. What is the Program Data Vector (PDV) and what are its functions? How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set? How would you code a merge that will keep only the observations that have matches from both sets? How would you delete observations with duplicate keys? How would you delete duplicate observations? Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables? If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable? When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? How would you include common or reuse code to be processed along with your statements? PSCI

Have you ever linked SAS code, If so, describe the link and any required statements used to either process the code or the step itself? What is the one statement to set the criteria of data that can be coded in any step? If you?re not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? What statement do you code to write the record to the file? What statement do you code to tell SAS that it is to write to an external file? Under what circumstances would you code a SELECT construct instead of IF statements? What is the purpose of the trailing and how would you use them? How would you code the criteria to restrict the output to be produced? Name and describe three SAS functions that you have used, if any? What is the difference between an informat and a format. Name three informats or formats. 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? Are you familiar with special input delimiters how are they used? How do you read in the variables that you need? What SAS statements would you code to read an external raw data file to a DATA step? NIIT What would you change about your job? Oracle How necessary is it to be creative in your work? Oracle If you could design your ideal job, what would it look like? Oracle Of all your work, where have you been the most successful? Oracle How do handle working under pressure? Oracle If money were no object, what would you like to do? Oracle Describe the function and utility of the most difficult SAS macro that you have written? Oracle Describe a time when you were really stuck on a problem and how you solved it? Oracle There is a river notoriously known for it?s large crocodile population. With ease, how do you safely cross it? Oracle The Lion King is hosting an animal conference. All the animals in the world attend except one. Which animal does not attend? Oracle How do you put an elephant in the refrigerator? Oracle

How do you put a giraffe into the refrigerator? Oracle Do you think professionally? Oracle Can you continue to write code while the rest of the people on the floor where you work have a noisy party to which you were not invited? Oracle How will you react when, while consulting a SAS documentation manual to get an answer to a problem, someone says hey, I thought you were supposed to know all that stuff already, and not have to look it up in a book? Oracle Will it bother you if the guy at the next desk times the frequency and duration of your bathroom or coffee breaks on the grounds that ?you are getting paid twice as much as he is?? Oracle What is your favorite all time computer book? Why? Oracle What was the last computer book you purchased? Why? Oracle What is the difference between verification and validation? Oracle How do you write a test plan? Oracle How experienced are you with customized reporting and use of Data _Null_ features? Oracle What do you feel about hardcoding? Oracle Are you involved in writing the inferential analysis plan? Tables specifications? Oracle Do you prefer Proc Report or Proc Tabulate? Why? Oracle What techniques and/or PROCs do you use for tables? Oracle Have you been involved in editing the data or writing data queries? Oracle Describe the types of SAS programming tasks that you performed like Tables? Listings? Graphics? Ad hoc reports? Other? Oracle In SAS how to read the variable values having different formats. eg:mar99,mar1999 (in a single variable) GSKGlaxoSmithKline How to select the observations randomly from a SAS dataset sas macros 11 2173 SAS System ? SAS Interview Questions SAS is the leader in business analytics software and services, and the largest independent vendor in the business intelligence market. SAS helps customers improve performance and deliver value by making better decisions faster. Important SAS Interview Questions and Answers 1. 2. What areas of SAS are you most interested in? Why is SAS considered self-documenting?

3.

Name and describe three SAS functions that you have used, if any?

4. What do the SAS log messages numeric values have been converted to character mean? What are the implications? 5. What SAS statements would you code to read an external raw data file to a DATA step?

6. If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didnt have a value? 7. What statement do you code to tell SAS that it is to write to an external file? What statement do you code to write the record to the file? If you do not want any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself. ? If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables? Does SAS Translate (compile) or does it Interpret? Explain. At compile time when a SAS data set is read, what items are created? Briefly describe 5 ways to do a table lockup in SAS. What versions of SAS have you used (on which platforms)? What are some good SAS programming practices for processing very large data sets? What are some problems you might encounter in processing missing values? In Data steps? Arithmetic? Comparisons? Functions? Classifying data?

8.

9.

10.

11. 12. 13. 14. 15. 16.

17. What is the order of application for output data set options, input data set options and SAS statements? 18. 19. 20. 21. How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? Have you ever used the SAS Debugger? What SAS features do you use for error trapping and data validation?

22. How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs? 23. 24. 25. 26. Very Basic What SAS statements would you code to read an external raw data file to a DATA step? How do you read in the variables that you need? Are you familiar with special input delimiters? How are they used?

27. 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? 28. 29. 30. 31. 32. What is the difference between an informat and a format? Name three informats or formats. Name and describe three SAS functions that you have used, if any? How would you code the criteria to restrict the output to be produced? What is the purpose of the trailing @? The @@? How would you use them? Under what circumstances would you code a SELECT construct instead of IF statements?

33. What statement do you code to tell SAS that it is to write to an external file? What statement do you code to write the record to the file? 34. If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? 35. If you're not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? 36. What is the one statement to set the criteria of data that can be coded in any step?

37. Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself. 38. How would you include common or reuse code to be processed along with your statements?

39. When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? 40. If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variables? 41. Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables. 42. 43. 44. How would you delete duplicate observations? How would you delete observations with duplicate keys? How would you code a merge that will keep only the observations that have matches from both sets.

45. How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set. 46. 47. 48. 49. Internals What is the Program Data Vector (PDV)? What are its functions? Does SAS 'Translate' (compile) or does it 'Interpret'? Explain. At compile time when a SAS data set is read, what items are created?

50. 51. 52. 53. 54. 55. 56. 57. 58.

Name statements that are recognized at compile time only? Identify statements whose placement in the DATA step is critical. Name statements that function at both compile and execution time. Name statements that are execution only. In the flow of DATA step processing, what is the first action in a typical DATA Step? What is _n_? Base SAS What is the effect of the OPTIONS statement ERRORS=1? What's the difference between VAR A1 - A4 and VAR A1 -- A4?

59. What do the SAS log messages "numeric values have been converted to character" mean? What are the implications? 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. Why is a STOP statement needed for the POINT= option on a SET statement? How do you control the number of observations and/or variables read or written? Approximately what date is represented by the SAS date value of 730? How would you remove a format that has been permanently associated with a variable?? What does the RUN statement do? Why is SAS considered self-documenting? What areas of SAS are you most interested in? Briefly describe 5 ways to do a "table lookup" in SAS. What versions of SAS have you used (on which platforms)? What are some good SAS programming practices for processing very large data sets? What are some problems you might encounter in processing missing values? *In Data steps? Arithmetic? Comparisons? Functions? Classifying data? How would you create a data set with 1 observation and 30 variables from a data set with 30 observations and 1 variable? What is the different between functions and PROCs that calculate the same simple descriptive statistics? If you were told to create many records from one record, show how you would do this using arrays and with PROC TRANSPOSE? What are _numeric_ and _character_ and what do they do? How would you create multiple observations from a single observation?

71.

72.

73.

74. 75.

76. 77. 78.

For what purpose would you use the RETAIN statement? What is a method for assigning first.VAR and last.VAR to the BY group variable on unsorted data? What is the order of application for output data set options, input data set options and SAS statements? What is the order of evaluation of the comparison operators: + - * / ** ( ) ? Testing, debugging How could you generate test data with no input data? How do you debug and test your SAS programs? What can you learn from the SAS log when debugging? What is the purpose of _error_? How can you put a "trace" in your program? Are you sensitive to code walk-throughs, peer review, or QC review? Have you ever used the SAS Debugger? What other SAS features do you use for error trapping and data validation? Missing values How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs? How many missing values are available? When might you use them? How do you test for missing values? How are numeric and character missing values represented internally? General What has been your most common programming mistake? What is your favorite programming language and why? What is your favorite operating system? Why? Do you observe any coding standards? What is your opinion of them? What percent of your program code is usually original and what percent copied and modified? Have you ever had to follow SOPs or programming guidelines? Which is worse: not testing your programs or not commenting your programs? Name several ways to achieve efficiency in your program. Explain trade-offs. What other SAS products have you used and consider yourself proficient in using?

79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90.

91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103.

104. 105. 106.

Functions How do you make use of functions? When looking for contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? What is the significance of the 'OF' in X=SUM(OF a1-a4, a6, a9);? What do the PUT and INPUT functions do? Which date function advances a date, time or date/time value by a given interval? What do the MOD and INT function do? How might you use MOD and INT on numerics to mimic SUBSTR on character strings? In ARRAY processing, what does the DIM function do? How would you determine the number of missing or nonmissing values in computations? What is the difference between: x=a+b+c+d; and x=SUM(a,b,c,d);?

107. 108. 109. 110. 111. 112. 113. 114.

115. There is a field containing a date. It needs to be displayed in the format "ddmonyy" if it's before 1975, "dd mon ccyy" if it's after 1985, and as 'Disco Years' if it's between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT. 116. In the following DATA step, what is needed for 'fraction' to print to the log? data _null_; x=1/3; if x=.3333 then put 'fraction'; run; 117. 118. 119. 120. What is the difference between calculating the 'mean' using the mean function and PROC MEANS? PROCs Have you ever used "Proc Merge"? (be prepared for surprising answers..) If you were given several SAS data sets you were unfamiliar with, how would you find out the variable names and formats of each dataset? What SAS PROCs have you used and consider yourself proficient in using? How would you keep SAS from overlaying the a SAS set with its sorted version? In PROC PRINT, can you print only variables that begin with the letter "A"? What are some differences between PROC SUMMARY and PROC MEANS? PROC FREQ:

121. 122. 123. 124. 125.

*Code the tables statement for a single-level (most common) frequency. *Code the tables statement to produce a multi-level frequency. *Name the option to produce a frequency line items rather that a table. *Produce output from a frequency. Restrict the printing of the table.

126.

PROC MEANS: *Code a PROC MEANS that shows both summed and averaged output of the data. *Code the option that will allow MEANS to include missing numeric data to be included in the report. *Code the MEANS to produce output to be used later.

127. 128. 129. 130. 131. data? 132. 133. 134. 135. 136. 137.

Do you use PROC REPORT or PROC TABULATE? Which do you prefer? Explain. Merging/Updating What happens in a one-on-one merge? When would you use one? How would you combine 3 or more tables with different structures? What is a problem with merging two data sets that have variables with the same name but different

When would you choose to MERGE two data sets together and when would you SET two data sets? Which data set is the controlling data set in the MERGE statement? How do the IN= variables improve the capability of a MERGE? Explain the message 'MERGE HAS ONE OR MORE DATASETS WITH REPEATS OF BY VARIABLES". Simple statistics How would you generate 1000 observations from a normal distribution with a mean of 50 and standard deviation of 20. How would you use PROC CHART to look at the distribution? Describe the shape of the distribution. How do you generate random samples? Customized Report Writing What is the purpose of the statement DATA _NULL_ ;? What is the pound sign used for in the DATA _NULL_? What would you use the trailing @ sign for? For what purpose(s) would you use the RETURN statement? How would you determine how far down on a page you have printed in order to print out footnotes? What is the purpose of using the N=PS option? Macro What system options would you use to help debug a macro? Describe how you would create a macro variable. How do you identify a macro variable?

138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149.

150. 151. 152. 153. 154. 155. 156. 157. 158.

How do you define the end of a macro? How do you assign a macro variable to a SAS variable? For what purposes have you used SAS macros? What is the difference between %LOCAL and %GLOBAL? How long can a macro variable be? A token? If you use a SYMPUT in a DATA step, when and where can you use the macro variable? What do you code to create a macro? End one? Describe how you would pass data to a macro. You have five data sets that need to be processed identically; how would you simplify that processing with a macro? How would you code a macro statement to produce information on the SAS log? This statement can be coded anywhere. How do you add a number to a macro variable? If you need the value of a variable rather than the variable itself, what would you use to load the value to a macro variable? Can you execute a macro within a macro? Describe. Can you a macro within another macro? If so, how would SAS know where the current macro ended and the new one began? How are parameters passed to a macro? Pharmaceutical Industry Describe the types of SAS programming tasks that you performed: Tables? Listings? Graphics? Ad hoc reports? Other? Have you been involved in editing the data or writing data queries? What techniques and/or PROCs do you use for tables? Do you prefer PROC REPORT or PROC TABULATE? Why? Are you involved in writing the inferential analysis plan? Tables specifications? What do you feel about hardcoding? How experienced are you with customized reporting and use of DATA _NULL_ features? How do you write a test plan? What is the difference between verification and validation? Open-ended questions

159.

160. 161.

162. 163.

164. 165. 166.

167. 168. 169. 170. 171. 172. 173. 174. 175.

176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186.

Describe a time when you were really stuck on a problem and how you solved it. Describe the function and utility of the most difficult SAS macro that you have written. Give me an example of .. Tell me how you dealt with ... How do handle working under pressure? Of all your work, where have you been the most successful? What are the best/worst aspects of your current job? If you could design your ideal job, what would it look like? How necessary is it to be creative in your work? If money were no object, what would you like to do? What would you change about your job?

What SAS statements would you code to read an external raw data file to a DATA step? INFILE statement. How do you read in the variables that you need? Using Input statement with the column pointers like @5/12-17 etc. Are you familiar with special input delimiters? How are they used? DLM and DSD are the delimiters that Ive used. They should be included in the infile statement. Comma separated values files or CSV files are a common type of file that can be used to read with the DSD option. DSD option treats two delimiters in a row as MISSING value. DSD also ignores the delimiters enclosed in quotation marks. 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? 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. What is the difference between an informat and a format? Name three informats or formats. Informats read the data. Format is to write the data. Informats: comma. dollar. date. Formats can be same as informatsInformats: MMDDYYw. DATEw. TIMEw. , PERCENTw,Formats: WORDIATE18., weekdatew. Name and describe three SAS functions that you have used, if any?

LENGTH: returns the length of an argument not counting the trailing blanks.(missing values have a length of 1)Ex: a=my cat; x=LENGTH(a); Result: x=6 SUBSTR: SUBSTR(arg,position,n) extracts a substring from an argument starting at position for n characters or until end if no n. Ex: data dsn; A=(916)734-6241; X=SUBSTR(a,2,3); RESULT: x=916 ; run; TRIM: removes trailing blanks from character expression. Ex: a=my ; b=cat;X= TRIM(a)(b); RESULT: x=mycat. SUM: sum of non missing values.Ex: x=Sum(3,5,1); result: x=9.0 INT: Returns the integer portion of the argument. How would you code the criteria to restrict the output to be produced? Use NOPRINT option. What is the purpose of the trailing @ and the @@? How would you use them? @ holds the value past the data step.@@ holds the value till a input statement or end of the line. Double trailing @@: When you have multiple observations per line of raw data, we should use double trailing signs (@@) at the end of the INPUT statement. The line hold specifies like a stop sign telling SAS, stop, hold that line of raw data. ex: data dsn; input sex $ days; cards; F 53 F 56

F 60 F 60 F 78 F 87 F 102 F 117 F 134 F 160 F 277 M 46 M 52 M 58 M 59 M 77 M 78 M 80 M 81 M 84 M 103 M 114 M 115 M 133 M 134 M 175 M 175 ; run; The above program can be changed to make the program shorter using @@ .... data dsn;

input sex $ days @@; cards; F 53 F 56 F 60 F 60 F 78 F 87 F 102 F 117 F 134 F 160 F 277M 46 M 52 M 58 M 59 M 77 M 78 M 80 M 81 M 84 M 103 M 114M 115 M 133 M 134 M 175 M 175 ; run; Trailing @: By using @ without specifying a column, it is as if you are telling SAS, stay tuned for more information. Dont touch that dial. SAS will hold the line of data until it reaches either the end of the data step or an INPUT statement that does not end with the trailing. Under what circumstances would you code a SELECT construct instead of IF statements? When you have a long series of mutually exclusive conditions and the comparison is numeric, using a SELECT group is slightly more efficient than using IF-THEN or IF-THEN-ELSE statements because CPU time is reduced. SELECT GROUP: Select: begins with select group.When: identifies SAS statements that are executed when a particular condition is true. Otherwise (optional): specifies a statement to be executed if no WHEN condition is met. End: ends a SELECT group. What statement you code to tell SAS that it is to write to an external file? What statement do you code to write the record to the file? PUT and FILE statements. If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? If you do not want any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? Data _Null_ What is the one statement to set the criteria of data that can be coded in any step? Options statement: This a part of SAS program and effects all steps that follow it. Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself . How would you include common or reuse code to be processed along with your statements? By using SAS Macros. When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc?

SCAN. If you have a data set that contains 100 variables, but you need only five of those, .what is the code to force SAS to use only those variable? Using KEEP option or statement. Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables. Proc sort data=one; BY State District County ; Run ; How would you delete duplicate observations? NONUPLICATES How would you delete observations with duplicate keys? NODUPKEY How would you code a merge that will keep only the observations that have matches from both sets. Check the condition by using If statement in the Merge statement while merging datasets. How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data. Step1: Define 3 datasets in DATA step Step2: Assign values of IN statement to different variables for 2 datasets Step3: Check for the condition using IF statement and output the matching to first dataset and no matches to different datasets Ex: data xxx; merge yyy(in = inxxx) zzz (in = inzzz); by aaa; if inxxx = 1 and inyyy = 1; run; What is the Program Data Vector (PDV)? What are its functions? Function: To store the current obs;PDV (Program Data Vector) is a logical area in memory where SAS creates a dataset one observation at a time. When SAS processes a data step it has two phases. Compilation phase and execution phase. During the compilation phase the input buffer is created to hold a record from external file. After input buffer is created the PDV is created. The PDV is the area of memory where SAS builds dataset, one observation at a time. The PDV contains two automatic variables _N_ and _ERROR_.

The Logical Program Data Vector (PDV) is a set of buffers that includes all variables referenced either explicitly or implicitly in the DATA step. It is created at compile time, then used at execution time as the location where the working values of variables are stored as they are processed by the DATA step program(source: http://www2.sas.com/proceedings/sugi24/Posters/p235-24.pdf). Does SAS 'Translate' (compile) or does it 'Interpret'? Explain. SAS compiles the code At compile time when a SAS data set is read, what items are created?Automatic variables are created. Input Buffer, PDV and Descriptor Information Name statements that are recognized at compile time only? PUT Name statements that are execution only. INFILE, INPUT .Identify statements whose placement in the DATA step is critical. DATA, INPUT, RUN. Name statements that function at both compile and execution time. INPUT In the flow of DATA step processing, what is the first action in a typical DATA Step? The DATA step begins with a DATA statement. Each time the DATA statement executes, a new iteration of the DATA step begins, and the _N_ automatic variable is incremented by 1. What is _n_? It is a Data counter variable in SAS. Note: Both -N- and _ERROR_ variables are always available to you in the data step .N- indicates the number of times SAS has looped through the data step.This is not necessarily equal to the observation number, since a simple sub setting IF statement can change the relationship between Observation number and the number of iterations of the data step.The ERROR- variable has a value of 1 if there is a error in the data for that observation and 0 if it is not. Ex: This is nothing but a implicit variable created by SAS during data processing. It gives the total number of records SAS has iterated in a dataset. It is Available only for data step and not for PROCS. Eg. If we want to find every third record in a Dataset thenwe can use the _n_ as follows Data new-sas-data-set; Set old; if mod(_n_,3)= 1 then; run; Note: If we use a where clause to subset the _n_ will not yield the required result. How do i convert a numeric variable to a character variable?

You must create a differently-named variable using the PUT function. How do i convert a character variable to a numeric variable? You must create a differently-named variable using the INPUT function. How can I compute the age of something? Given two sas date variables born and calc: age = int(intck('month',born,calc) / 12); if month(born) = month(calc) then age = age - (day(born) > day(calc)); How can I compute the number of months between two dates? Given two sas date variables begin and end: months = intck('month',begin,end) - (day(end) <> How can I determine the position of the nth word within a character string? Use a combination of the INDEXW and SCAN functions:pos = indexw(string,scan(string,n)); I need to reorder characters within a string...use SUBSTR? You can do this using only one function call with TRANSLATE versus two functions calls with SUBSTR. The following lines each move the first character of a 4-character string to the last: reorder = translate('2341',string,'1234'); reorder = substr(string,2,3) substr(string,1,1);How can I put my sas date variable so that December 25, 1995 would appear as '19951225'? (with no separator) use a combination of the YEAR. and MMDDYY. formats to simply display the value: put sasdate year4. sasdate mmddyy4.; or use a combination of the PUT and COMPRESS functions to store the value: newvar = compress(put(sasdate,yymmdd10.),'/'); How can I put my sas time variable with a leading zero for hours 1-9? Use a combination of the Z. and MMSS. formats: hrprint = hour(sastime); put hrprint z2. ':' sastime mmss5.; INFILE OPTIONS Prepared by Sreeja E V(sreeja@kreara.com) source: kreara.blogspot.com. Infile has a number of options available. FLOWOVER

FLOWOVER is the default option on INFILE statement. Here, when the INPUT statement reaches the end of non-blank characters without having filled all variables, a new line is read into the Input Buffer and INPUT attempts to fill the rest of the variables starting from column one. The next time an INPUT statement is executed, a new line is brought into the Input Buffer. Consider the following text file containing three variables id, type and amount. 11101 A 11102 A 100 11103 B 43 11104 C 11105 C 67

The following SAS code uses the flowover option which reads the next non missing values for missing variables.

data B; infile "External file" flowover; input id $ type $ amount; run; which creates the following dataset MISSOVERWhen INPUT reads a short line, MISSOVER option on INFILE statement does not allow it to move to the next line. MISSOVER option sets all the variables without values to missing. data B; infile "External file" missover; input id $ type $ amount; run; which creates the following dataset TRUNCOVER Causes the INPUT statement to read variable-length records where some records are shorter than the INPUT statement expects. Variables which are not assigned values are set to missing. Difference between TRUNCOVER and MISSOVER Both will assign missing values to variables if the data line ends before the variables field starts. But when the data line ends in the middle of a variable field, TRUNCOVER will take as much as is there, whereas MISSOVER will assign the variable a missing value.

Consider the text file below containing a character variable chr. a bb ccc dddd eeeee ffffff Consider the following SAS code data trun; infile "External file" truncover; input chr $3. ; run;

When using truncover option we get the following dataset

data miss; infile "External file" missover; input chr $3. ; run; While using missover option we get the output

Different Ways to use PUT Statement; http://www.cmg.org/measureit/issues/mit45/m_45_10.html %include statement: which looks like a macro but isn't really, sucks the contents of the just-generated file into the input stream. The result will be that the step will effectively contain all of the rename statements generated in the previous step, accomplishing the renaming of all columns. SAS interview questions: General Under what circumstances would you code a SELECT construct instead of IF statements? A: I think Select statement are used when you are using one condition to compare with several conditions likeselect passwhen Physics >60when math > 100when English = 50;otherwise fail; What is the one statement to set the criteria of data that can be codedin any step?

A) Options statement. What is the effect of the OPTIONS statement ERRORS=1? is a error in the data for that observation and 0 if it is not. A) The ERROR- variable ha a value of 1 if there

What's the difference between VAR A1 - A4 and VAR A1 -- A4 ? A: There is no diff between VAR A1-A4 an VAR A1A4. Where as If u submit VAR A1---A4 instead of VAR A1-A4 or VAR A1A3, u will see error message in the log. What do the SAS log messages "numeric values have been converted to character" mean? What are the implications? It implies that automatic conversion took place to make character functions possible Why is a STOP statement needed for the POINT= option on a SET statement? Because POINT= reads only the specified observations, SAS cannot detect an end-of-file condition as it would if the file were being read sequentially. How do you control the number of observations and/or variables read or written? FIRSTOBS and OBS optionApproximately What date is represented by the SAS date value of 730? 31st December 1961 A: INPUT, DATA and RUN

Identify statements whose placement in the DATA step is critical.

Does SAS 'Translate' (compile) or does it 'Interpret'? Explain. A) Compile What does the RUN statement do? a) When SAS editor looks at Run it starts compiling the data or proc step, if you have more than one data step or proc step or if you have a proc step Following the data step then you can avoid the usage of the run statement. Why is SAS considered self-documenting? A) SAS is considered self documenting because during the compilation time it creates and stores all the information about the data set like the time and date of the data set creation later No. of the variables later labels all that kind of info inside the dataset and you can look at that infousing proc contents procedure. What are some good SAS programming practices for processing very large data sets? can use firstobs = and obs = , A) Sort them once,

What is the different between functions and PROCs that calculate the same simple descriptive statistics? A) Functions can used inside the data step and on the same data set but with proc's you can create a new data sets to output the results. May be more ........... If you were told to create many records from one record, show how youwould do this using arrays and with PROC TRANSPOSE? A) I would use TRANSPOSE if the variables are less use arrays if the var are more ................. depends What is a method for assigning first.VAR and last.VAR to the BY groupvariable on unsorted data? Unsorted data you can't use First. or Last. A) In

How do you debug and test your SAS programs? A) First thing is look into Log for errors or warning or NOTE in some cases or use the debugger in SAS data step.

What other SAS features do you use for error trapping and datavalidation? A) Check the Log and for data validation things like Proc Freq, Proc means or some times proc print to look how the data looks like ........ How would you combine 3 or more tables with different structures? A) I think sort them with common variables and use merge statement. I am not sure what you mean different structures. What areas of SAS are you most interested in? BASE, STAT, GRAPH, ETSBriefly describe 5 ways to do a "table lookup" in SAS.Match Merging, Direct Access, Format Tables, Arrays, PROC SQL What versions of SAS have you used (on which platforms)? SAS 8.2 in Windows and UNIX, SAS 7 and 6.12 Sampling method

What are some good SAS programming practices for processing very large data sets? using OBS option or subsetting, commenting the Lines, Use Data Null 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 missing value will result in missing value. Most SAS statistical procedures exclude observations with any missing variable values from an analysis. 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 What is the different between functions and PROCs that calculate the same simple descriptive statistics? Proc can be used with wider scope and the results can be sent to a different dataset. Functions usually affect the existing datasets. 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 number of variables in the record and then used Do loopProc Transpose with VAR statement. What are _numeric_ and _character_ and what do they do? Will either read or writes all numeric and character variables in dataset. How would you create multiple observations from a single observation? Using double Trailing @@ For what purpose would you use the RETAIN statement? The retain statement is used to hold the values of variables across iterations of the data step. Normally, all variables in the data step are set to missing at the start of each iteration of the data step. What is the order of evaluation of the comparison operators: + - * / ** ()?(), **, *, /, +, -

How could you generate test data with no input data?Using Data Null and put statementHow do you debug and test your SAS programs? Using Obs=0 and systems options to trace the program execution in log. What can you learn from the SAS log when debugging? It will display the execution of whole program and the logic. It will also display the error with line number so that you can and edit the program. What is the purpose of _error_? It has only to values, which are 1 for error and 0 for no error How can you put a "trace" in your program? By using ODS TRACE ON How does SAS handle missing values in: assignment statements, functions, a merge, an update, sort order, formats, PROCs? Missing values will be assigned as missing in Assignment statement. Sort order treats missing as second smallest followed by underscore. How do you test for missing values? Using Subset functions like IF then Else, Where and SelectHow are numeric and character missing values represented internally? Character as Blank or and Numeric as. Which date functions advances a date time or date/time value by a given interval? INTNX. In the flow of DATA step processing, what is the first action in a typical DATA Step? When you submit a DATA step, SAS processes the DATA step and then creates a new SAS data set.( creation of input buffer and PDV)Compilation PhaseExecution Phase What are SAS/ACCESS and SAS/CONNECT? SAS/Access only process through the databases like Oracle, SQL-server, Ms-Access etc. SAS/Connect only use Server connection. What is the one statement to set the criteria of data that can be coded in any step? OPTIONS Statement, Label statement, Keep / Drop statements.What is the purpose of using the N=PS option?The N=PS option creates a buffer in memory which is large enough to store PAGESIZE (PS) lines and enables a page to be formatted randomly prior to it being printed. What are the scrubbing procedures in SAS?

Proc Sort with nodupkey option, because it will eliminate the duplicate values. What are the new features included in the new version of SAS i.e., SAS9.1.3? The main advantage of version 9 is faster execution of applications and centralized access of data and support.There are lots of changes has been made in the version 9 when we compared with the version 8. The following are the few:SAS version 9 supports Formats longer than 8 bytes & is not possible with version 8. Length for Numeric format allowed in version 9 is 32 where as 8 in version 8. Length for Character names in version 9 is 31 where as in version 8 is 32. Length for numeric informat in version 9 is 31, 8 in version 8.Length for character names is 30, 32 in version 8.3 new informats are available in version 9 to convert various date, time and datetime forms of data into a SAS date or SAS time. ANYDTDTEW. - Converts to a SAS date value ANYDTTMEW. - Converts to a SAS time value. ANYDTDTMW. Converts to a SAS datetime value.CALL SYMPUTX Macro statement is added in the version 9 which creates a macro variable at execution time in the data step by Trimming trailing blanks Automatically converting numeric value to character. New ODS option (COLUMN OPTION) is included to create a multiple columns in the output.WHAT DIFFERRENCE DID YOU FIND AMONG VERSION 6 8 AND 9 OF SAS. The SAS 9 Architecture is fundamentally different from any prior version of SAS. In the SAS 9 architecture, SAS relies on a new component, the Metadata Server, to provide an information layer between the programs and the data they access. Metadata, such as security permissions for SAS libraries and where the various SAS servers are running, are maintained in a common repository. What has been your most common programming mistake? Missing semicolon and not checking log after submitting program, Not using debugging techniques and not using Fsview option vigorously. Name several ways to achieve efficiency in your program. Explain trade-offs. Efficiency and performance strategies can be classified into 5 different areas. CPU time Data Storage Elapsed time Input/Output Memory CPU Time and Elapsed Time- Base line measurements Few Examples for efficiency violations: Retaining unwanted datasets Not sub setting early to eliminate unwanted records.

Efficiency improving techniques: Using KEEP and DROP statements to retain necessary variables. Use macros for reducing the code. Using IF-THEN/ELSE statements to process data programming. Use SQL procedure to reduce number of programming steps. Using of length statements to reduce the variable size for reducing the Data storage.Use of Data _NULL_ steps for processing null data sets for Data storage. What other SAS products have you used and consider yourself proficient in using? Data _NULL_ statement, Proc Means, Proc Report, Proc tabulate, Proc freq and Proc print, Proc Univariate etc. What is the significance of the 'OF' in X=SUM (OF a1-a4, a6, a9); If dont use the OF function it might not be interpreted as we expect. For example the function above calculates the sum of a1 minus a4 plus a6 and a9 and not the whole sum of a1 to a4 & a6 and a9. It is true for mean option also. What do the PUT and INPUT functions do? INPUT function converts character data values to numeric values. PUT function converts numeric values to character values. EX: for INPUT: INPUT (source, informat)For PUT: PUT (source, format)Note that INPUT function requires INFORMAT and PUT function requires FORMAT. If we omit the INPUT or the PUT function during the data conversion, SAS will detect the mismatched variables and will try an automatic character-to-numeric or numeric-to-character conversion. But sometimes this doesnt work because $ sign prevents such conversion. Therefore it is always advisable to include INPUT and PUT functions in your programs when conversions occur. Which date function advances a date, time or datetime value by a given interval? INTNX: INTNX function advances a date, time, or datetime value by a given interval, and returns a date, time, or datetime value. Ex: INTNX(interval,start-from,number-of-increments,alignment) INTCK: INTCK(interval,start-of-period,end-of-period) is an interval functioncounts the number of intervals between two give SAS dates, Time and/or datetime. DATETIME () returns the current date and time of day. DATDIF (sdate,edate,basis): returns the number of days between two dates. What do the MOD and INT function do? What do the PAD and DIM functions do? MOD: Modulo is a constant or numeric variable, the function returns the reminder after numeric value divided by modulo. INT: It returns the integer portion of a numeric value truncating the decimal portion. 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. CATX: concatenate character strings, removes leading and trailing blanks and inserts separators. SCAN: it returns a specified word from a character value. Scan function assigns a length of 200 to each target variable.

SUBSTR: extracts a sub string and replaces character values.Extraction of a substring: Middleinitial=substr(middlename,1,1); Replacing character values: substr (phone,1,3)=433; If SUBSTR function is on the left side of a statement, the function replaces the contents of the character variable.TRIM: trims the trailing blanks from the character values. SCAN vs. SUBSTR: SCAN extracts words within a value that is marked by delimiters. SUBSTR extracts a portion of the value by stating the specific location. It is best used when we know the exact position of the sub string to extract from a character value. How might you use MOD and INT on numeric to mimic SUBSTR on character Strings? The first argument to the MOD function is a numeric, the second is a non-zero numeric; the result is the remainder when the integer quotient of argument-1 is divided by argument-2. The INT function takes only one argument and returns the integer portion of an argument, truncating the decimal portion. Note that the argument can be an expression. DATA NEW ; A = 123456 ; X = INT( A/1000 ) ; Y = MOD( A, 1000 ) ; Z = MOD( INT( A/100 ), 100 ) ; PUT A= X= Y= Z= ; RUN ; A=123456 X=123 Y=456 Z=34

In ARRAY processing, what does the DIM function do? DIM: It is used to return the number of elements in the array. When we use Dim function we would have to re specify the stop value of an iterative DO statement if u change the dimension of the array. How would you determine the number of missing or nonmissing values in computations? 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). Do you need to know if there are any missing values? Just use: missing_values=MISSING(field1,field2,field3); This function simply returns 0 if there aren't any or 1 if there are missing values. If you need to know how many missing values you have then use num_missing=NMISS(field1,field2,field3); You can also find the number of non-missing values with non_missing=N (field1,field2,field3); What is the difference between: x=a+b+c+d; and x=SUM (of a, b, c ,d);? Is anyone wondering why you wouldnt just use total=field1+field2+field3; First, how do you want missing values handled? The SUM function returns the sum of non-missing values. If you choose addition, you will get a missing value for the result if any of the fields are missing. Which one is appropriate depends upon your needs. However, there is an advantage to use the SUM function even if you want the results to be missing. If you have more than a couple fields, you can often use shortcuts in writing the field names If your fields are not numbered sequentially but are stored in the program data vector together then you can use: total=SUM(of fielda--zfield); Just make sure you remember the of and the double dashes or your code will run but you wont get your intended results. Mean is another function where the function will calculate differently than the writing out the formula if you have missing values. There is a field containing a date. It needs to be displayed in the format "ddmonyy" if it's before 1975, "dd mon ccyy" if it's after 1985, and as 'Disco Years' if it's between 1975 and 1985. How would you accomplish this in data step code? Using only PROC FORMAT. data new ; input date ddmmyy10.; cards; 01/05/1955 01/09/1970 01/12/1975 19/10/1979 25/10/1982 10/10/1988

27/12/1991 ; run; proc format ; value dat low-'01jan1975'd=ddmmyy10. '01jan1975'd-'01JAN1985'd="Disco Years" '01JAN1985'd-high=date9.; run; proc print; format date dat. ; run; In the following DATA step, what is needed for 'fraction' to print to the log? data _null_; x=1/3; if x=.3333 then put 'fraction'; run; What is the difference between calculating the 'mean' using the mean function and PROC MEANS? By default Proc Means calculate the summary statistics like N, Mean, Std deviation, Minimum and maximum, Where as Mean function compute only the mean values. What are some differences between PROC SUMMARY and PROC MEANS? Proc means by default give you the output in the output window and you can stop this by the option NOPRINT and can take the output in the separate file by the statement OUTPUTOUT= , But, proc summary doesn't give the default output, we have to explicitly give the output statement and then print the data by giving PRINT option to see the result. What is a problem with merging two data sets that have variables with the same name but different data? Understanding the basic algorithm of MERGE will help you understand how the stepProcesses. There are still a few common scenarios whose results sometimes catch users off guard. Here are a few of the most frequent 'gotchas': 1- BY variables has different lengthsIt is possible to perform a MERGE when the lengths of the BY variables are different, But if the data set with the shorter version is listed first on the MERGE statement,

theShorter length will be used for the length of the BY variable during the merge. Due to this shorter length, truncation occurs and unintended combinations could result. In Version 8, a warning is issued to point out this data integrity risk. The warning will be issued regardless of which data set is listed first: WARNING: Multiple lengths were specified for the BY variable name by input data sets.This may cause unexpected results. Truncation can be avoided by naming the data set with the longest length for the BY variable first on the MERGE statement, but the warning message is still issued. To prevent the warning, ensure the BY variables have the same length prior to combining them in the MERGE step with PROC CONTENTS. You can change the variable length with either a LENGTH statement in the merge DATA step prior to the MERGE statement, or by recreating the data sets to have identical lengths for the BY variables. Note: When doing MERGE we should not have MERGE and IF-THEN statement in one data step if the IF-THEN statement involves two variables that come from two different merging data sets. If it is not completely clear when MERGE and IF-THEN can be used in one data step and when it should not be, then it is best to simply always separate them in different data step. By following the above recommendation, it will ensure an error-free merge result. Which data set is the controlling data set in the MERGE statement? Dataset having the less number of observations control the data set in the merge statement. How do the IN= variables improve the capability of a MERGE? The IN=variables What if you want to keep in the output data set of a merge only the matches (only those observations to which both input data sets contribute)? SAS will set up for you special temporary variables, called the "IN=" variables, so that you can do this and more. Here's what you have to do: signal to SAS on the MERGE statement that you need the IN= variables for the input data set(s) use the IN= variables in the data step appropriately, So to keep only the matches in the match-merge above, ask for the IN= variables and use them: data three; merge one(in=x) two(in=y); /* x & y are your choices of names */ by id; /* for the IN= variables for data */ if x=1 and y=1; /* sets one and two respectively */ run; What techniques and/or PROCs do you use for tables? Proc Freq, Proc univariate, Proc Tabulate & Proc Report.

Do you prefer PROC REPORT or PROC TABULATE? Why? I prefer to use Proc report until I have to create cross tabulation tables, because, It gives me so many options to modify the look up of my table, (ex: Width option, by this we can change the width of each column in the table) Where as Proc tabulate unable to produce some of the things in my table. Ex: tabulate doesnt produce n (%) in the desirable format. How experienced are you with customized reporting and use of DATA _NULL_ features? I have very good experience in creating customized reports as well as with Data _NULL_ step. Its a Data step that generates a report without creating the dataset there by development time can be saved. The other advantages of Data NULL is when we submit, if there is any compilation error is there in the statement which can be detected and written to the log there by error can be detected by checking the log after submitting it. It is also used to create the macro variables in the data set. What is the difference between nodup and nodupkey options? NODUP compares all the variables in our dataset while NODUPKEY compares just the BY variables. What is the difference between compiler and interpreter? Give any one example (software product) that act as an interpreter? Both are similar as they achieve similar purposes, but inherently different as to how they achieve that purpose. The interpreter translates instructions one at a time, and then executes those instructions immediately. Compiled code takes programs (source) written in SAS programming language, and then ultimately translates it into object code or machine language. Compiled code does the work much more efficiently, because it produces a complete machine language program, which can then be executed. Code the tables statement for a single level frequency? Proc freq data=lib.dataset; table var; *here you can mention single variable of multiple variables seperated by space to get single frequency; run; What is the main difference between rename and label? 1. Label is global and rename is local i.e., label statement can be used either in proc or data step where as rename should be used only in data step. 2.If we rename a variable, old name will be lost but if we label a variable its short name (old name) exists along with its descriptive name. What is Enterprise Guide? What is the use of it? It is an approach to import text files with SAS (It comes free with Base SAS version 9.0) What other SAS features do you use for error trapping and data validation? What are the validation tools in SAS? For dataset: Data set name/debug

Data set: name/stmtchk For macros: Options:mprint mlogic symbolgen.How can you put a "trace" in your program?ODS Trace ON, ODS Trace OFF the trace records. How would you code a merge that will keep only the observations that have matches from both data sets? Using "IN" variable option. Look at the following example. data three; merge one(in=x) two(in=y); by id; if x=1 and y=1; run; or data three; merge one(in=x) two(in=y); by id; if x and y; run; What are input dataset and output dataset options? Input data set options are obs, firstobs, where, in output data set options compress, reuse.Both input and output dataset options include keep, drop, rename, obs, first obs. How can u create zero observation dataset? Creating a data set by using the like clause. ex: proc sql; create table latha.emp like oracle.emp; quit; In this the like clause triggers the existing table structure to be copied to the new table. using this method result in the creation of an empty table. Have you ever-linked SAS code, If so, describe the link and any required statements used to either process the code or the step itself? In the editor window we write %include 'path of the sas file';

run; if it is with non-windowing environment no need to give run statement. How can u import .CSV file in to SAS? tell Syntax? To create CSV file, we have to open notepad, then, declare the variables. proc import datafile='E:\age.csv'out=sarathdbms=csv replace;getnames=yes; proc print data=sarath; run; What is the use of Proc SQl? PROC SQL is a powerful tool in SAS, which combines the functionality of data and proc steps. PROC SQL can sort, summarize, subset, join (merge), and concatenate datasets, create new variables, and print the results or create a new dataset all in one step! PROC SQL uses fewer resources when compard to that of data and proc steps. To join files in PROC SQL it does not require to sort the data prior to merging, which is must, is data merge. What is SAS GRAPH? SAS/GRAPH software creates and delivers accurate, high-impact visuals that enable decision makers to gain a quick understanding of critical business issues. Why is a STOP statement needed for the point=option on a SET statement? When you use the POINT= option, you must include a STOP statement to stop DATA step processing, programming logic that checks for an invalid value of the POINT= variable, or Both. Because POINT= reads only those observations that are specified in the DO statement, SAS cannot read an end-of-file indicator as it would if the file were being read sequentially. Because reading an end-of-file indicator ends a DATA step automatically, failure to substitute another means of ending the DATA step when you use POINT= can cause the DATA step to go into a continuous loop. What is the difference between nodup and nodupkey options? The NODUP option checks for and eliminates duplicate observations. The NODUPKEY option checks for and eliminates duplicate observations by variable values. proc format ; value dat low-'01jan1975'd= [date7.] '01jan1975'd-'01jan1985'd="Disco Years" '01jan1985'd-high=[date9.]; run; For one of the questions above this is the correct code for the question asked. 1. have you ever linked sas code? if so, describe the link and any

required statements used to either process the code or step itself? 2. What is the Program Data Vector(PDV)? what are its functions? 3. Does sas 'translate' (compile) or does it 'Interpret'? explain. 4.At compile time when a sas data set is read, what items are created? 5. Name statements that are execution only. 6. In the flow of Data step processing, what is the first action in typical data step? 7. what's the difference between var A1-A4 and var A1--A4? 8.why is sas conisdered self-documenting? 9.Briefly describe 5 ways to do a 'table look up' in sas. 10. what are some good sas programming practices for processing very large data sets? 11.what are some problems you might encounter in processing missing values? In data steps?Arithmetic ? Comparsion? Functions? Classfying data? 12. what is the difference between function PROCs that calculate the same simple descriptive statistics? 13. if you were given several sas data sets you were unfamiliar with, how would you find out the variable names and formats of each dataset? 14. Reply to this Message data _null_; - 10 Jan 2007 16:50 GMT Why don't you spend some time researching the answers, you will learn a lot. You can find all the answers in the users guide. You can also find volumes on these subjects in SGF(SUGI) papers. All that stuff is presented over and over each year in the tutorials section etc. Then write back to the list with your answers and let the list members help you from there. If you research the answers you will learn more. > I saw some interview question of sas, but I don't know the exact > answer, who can give me some hint, any help is greatly appreciated!

[quoted text clipped - 33 lines] > > 14. Reply to this Message Lou - 11 Jan 2007 01:52 GMT I was going to say "truthfully", but after looking over the questions, decided that's insufficient.

Rule 1. Always answer interview questions truthfully - if you haven't done something (like question 1 for instance) say so. If you have something meaningful to say about the operation under discussion anyway, say it. Rule 2. Don't try to bullshit your way through the interview. You're just wasting your time. Observation. I assume the interviewer is asking relevant questions that s/he believes will aid in coming to a reasonably accurate judgement as to whether or not you can do the job. If you don't know the answers or how to go about finding or figuring out the answers, there's a possibility you'll fail at the job. Memorizing a series of canned responses might get you a job offer, but is unlikely to help you much once you sit down at your new desk. Consider if this is a job you want.Observation. I've been programming with SAS for something like 22-23 years. A dozen of those years I was a SAS consultant. I've never been asked any of these questions in a job interview. >I saw some interview question of sas, but I don't know the exact > answer, who can give me some hint, any help is greatly appreciated! [quoted text clipped - 33 lines] > > 14. Reply to this Message Robert - 11 Jan 2007 02:47 GMT > I saw some interview question of sas, but I don't know the exact > answer, who can give me some hint, any help is greatly appreciated! [quoted text clipped - 33 lines] >

> 14. Now hold on, folks, some of these are interesting questions. So don't be so dismissive. >From the user's point of view, SAS looks like an interpreter. I have used it for many years, so it does look like that. But in reality , it must be a just-in-time compile, because with the resources SAS has had for three decades, an interpreter makes absolutely no sense, especially for very large datasets. Oh, and it looks like question # 4 actually gives the answer to question # 3. And people can use SAS for years and never have to link SAS object/execuatable files. No , SAS is not self-documenting. Is that really true of any language. If you want to see more of my comments on SAS and other statistical software , you can check out stuff at datahelper.blogspot.com or www.my.opera.com/datahelper Here's a question : What do you think the ratio of full-time SAS programmers to full-time SPSS programmers is? Or full time S-Plus/R programmers? I wonder. Reply to this Message toby dunn - 11 Jan 2007 02:50 GMT I found non of the questions interesting. I care to bet that all of these have been asked and answered on the list before and I believe all answers can be found in the docs. I have been asked some of these in the past, however I might add by people who knew less about SAS than I. Probably why Idont ask these questions when I interview people. I would rather ask other questions and then test them.

Toby Dunn To sensible men, every day is a day of reckoning. ~John W. Gardner The important thing is this: To be able at any moment to sacrifice that which we are for what we could become. ~Charles DuBois Don't get your knickers in a knot. Nothing is solved and it just makes you walk funny. ~Kathryn Carpenter From: Robert <callingrw@YAHOO.COM> Reply-To: Robert <callingrw@YAHOO.COM> To: SAS-L@LISTSERV.UGA.EDU Subject: Re: sas interview questions, how to answer? Date: Wed, 10 Jan 2007 18:47:02 -0800 > I saw some interview question of sas, but I don't know the exact > answer, who can give me some hint, any help is greatly appreciated! [quoted text clipped - 33 lines] > > 14. Now hold on, folks, some of these are interesting questions. So don't be so dismissive. >From the user's point of view, SAS looks like an interpreter. I have used it for many years, so it does look like that. But in reality , it must be a just-in-time compile, because with the resources SAS has had for three decades, an interpreter makes absolutely no sense, especially for very large datasets. Oh, and it looks like question # 4 actually gives the answer to question # 3. And people can use SAS for years and never have to link SAS object/execuatable files. No , SAS is not self-documenting. Is that really true of any language. If you want to see more of my comments on SAS and other statistical

software , you can check out stuff at datahelper.blogspot.com or www.my.opera.com/datahelper Here's a question : What do you think the ratio of full-time SAS programmers to full-time SPSS programmers is? Or full time S-Plus/R programmers? I wonder. 1. Have you used macros? For what purpose you have used? Yes I have, I used macros in creating analysis datasets and tables where it is necessary to make a small change through out the program and where it is necessary to use the code again and again. 2. How would you invoke a macro? After I have defined a macro I can invoke it by adding the percent sign prefix to its name like this: % macro name a semicolon is not required when invoking a macro, though adding one generally does no harm. 3. How can you create a macro variable with in data step? with CALL SYMPUT 4. How would you identify a macro variable? with Ampersand (&) sign 5. How would you define the end of a macro? The end of the macro is defined by %Mend Statement 6. For what purposes have you used SAS macros? If we want use a program step for executing to execute the same Proc step on multiple data sets. We can accomplish repetitive tasks quickly and efficiently. A macro program can be reused many times. Parameters passed to the macro program customize the results without having to change the code within the macro program. Macros in SAS make a small change in the program and have SAS echo that change thought that program. 7. What is the difference between %LOCAL and %GLOBAL? % Local is a macro variable defined inside a macro.%Global is a macro variable defined in open code (outside the macro or can use anywhere). 8. How long can a macro variable be? A token? A component of SAS known as the word scanner breaks the program text into fundamental units called tokens. Tokens are passed on demand to the compiler. The compiler then requests token until it receives a semicolon.

Then the compiler performs the syntax check on the statement. 9. If you use a SYMPUT in a DATA step, when and where can you use the macro variable? 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.. 10. What do you code to create a macro? End one? We create a macro with %MACRO statement and end a macro with %MEND statemnt. 11. What is the difference between %PUT and SYMBOLGEN? %PUT is used to display user defined messages on log window after execution of a program where as % SYMBOLGEN is used to print the value of a macro variable resolved, in log window. 12. How do you add a number to a macro variable? Using %eval function or %sysevalf function if the number is a floating number. 13. Can you execute a macro within a macro? Describe. Yes, Such macros are called nested macros. They can be obtained by using symget and call symput macros. 14. If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable? If we need a value of a macro variable then we must define it in such terms so that we can call them everywhere in the program. Define it as Global. There are different ways of assigning a global variable. Simplest method is %LET.

Ex: A, is macro variable. Use following statement to assign the value of a rather than the variable itself %Let A=xyz; %put x="&A"; This will assign "xyz" to x, not the variable xyz to x. 15. Can you execute macro within another macro? If so, how would SAS know where the current macro ended and the new one began? Yes, I can execute macro within a macro, we call it as nesting of macros, which is allowed. Every macro's beginning is identified the keyword %macro and end with %mend. 16. How are parameters passed to a macro? A macro variable defined in parentheses in a %MACRO statement is a macro parameter. Macro parameters allow you to pass information into a macro. Here is a simple example: %macro plot(yvar= ,xvar= );

proc plot; plot &yvar*&xvar; run; %mend plot; %plot(age,sex) 17. How would you code a macro statement to produce information on the SAS log? This statement can be coded anywhere? OPTIONS MPRINT MLOGIC MERROR SYMBOLGEN; 18. How we can call macros with in data step? We can call the macro with CALL SYMPUT, Proc SQL , %LET statement. and macro parameters. 19. Tell me about call symput? CALL SYMPUT takes a value from a data step and assigns it to a macro variable. I can then use this macro variable in later steps. To assign a value to a single macro variable, I use CALL SYMPUT with this general form: CALL SYMPUT (macro-variable-name, value); Where macro-variable-name, enclosed in quotation marks, is the name of a macro variable, and value is the value I want to assign to that macro variable. Value can be the name of a variable whose value SAS will use, or it can be a constant value enclosed quotation marks. more abt callsymput routine can be read at: http://studysas.blogspot.com/2009/08/call-symput-vs-call-symputx.html CALL SYMPUT is often used in if-then statements such as this: If age>=18 then call symput (status,adult); else call symput (status,minor); These statements create a macro variable named &status and assign to it a value of either adult or minor depending on the variable age.Caution: We cannot create a macro variable with CALL SYMPUT and use it in the same data step because SAS does not assign a value to the macro variable until the data step executes. Data steps executes when SAS encounters a step boundary such as a subsequent data, proc, or run statement. 20. Tell me about % include and % eval?

The %include statement, despite its percent sign, is not a macro statement and is always executed in SAS, though it can be conditionally executed in a macro.It can be used to setting up a macro library. But this is a least approach. The use of %include does not actually set up a library. The %include statement points to a file and when it executed the indicated file (be it a full program, macro definition, or a statement fragment) is inserted into the calling program at the location of the call. When using the %include building a macro library, the included file will usually contain one or more macro definitions.%EVAL is a widely used yet frequently misunderstood SAS(r) macro language function due to its seemingly simple form. However, when its actual argument is a complex macro expression interlaced with special characters, mixed arithmetic and logical operators, or macro quotation functions, its usage and result become elusive and problematic. %IF condition in macro is evaluated by %eval, to reduce it to true or false. 21. Describe the ways in which you can create macro variables? There are the 5 ways to create macro variables: %Let %Global Call Symput Proc SQl into clause Macro Parameters. 22. Tell me more about the parameters in macro? Parameters are macro variables whose value you set when you invoke a macro. To add the parameters to a macro, you simply name the macro vars names in parenthesis in the %macro statement. Syntax: %MACRO macro-name (parameter-1= , parameter-2= , parameter-n = ); macro-text%; %MEND macro-name; %macro_name(par1,par2,....parn); 23. What is the maximum length of the macro variable? 32 characters long. 24. Automatic variables for macro? Every time we invoke SAS, the macro processor automatically creates certain macro var. eg: &sysdate &sysday. 25. What system options would you use to help debug a macro?

The SAS System offers users a number of useful system options to help debug macro issues and problems. The results associated with using macro options are automatically displayed on the SAS Log.

Specific options related to macro debugging appear in alphabetical order in the table below:

MEMRPT: Specifies that memory usage statistics be displayed on the SAS Log. MERROR: SAS will issue warning if we invoke a macro that SAS didnt find. Presents Warning Messages when there are misspellings or when an undefined macro is called. SERROR: SAS will issue warning if we use a macro variable that SAS cant find. 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. 27. What are SYMGET and SYMPUT? SYMPUT puts the value from a dataset into a macro variable where as SYMGET gets the value from the macro variable to the dataset. 28. What are the macros you have used in your programs? Used macros for various puposes, few of them are.. 1) Macros written to determine the list of variables in a dataset: %macro varlist (dsn); proc contents data = &dsn out = cont noprint; run; %mend; %varlist(demo); proc sql noprint; select distinct name into:varname1-:varname22 from cont; quit; %do i =1 %to &sqlobs; %put &i &&varname&i; %end;

%mend varlist; %varlist(adverse) 2) Distribution or Missing / Non-Missing Values %macro missrep (dsn, vars=_numeric_); proc freq data=&dsn.; tables &vars. / missing; format _character_ $missf. _numeric_ missf.; title1 Distribution or Missing / Non-Missing Values; run; %mend missrep; %missrep(study.demog, vars=age gender bdate); 3) Written macros for sorting common variables in various datasets %macro sortit (datasetname,pid,inverstigator); PROC SORT DATA = &DATASETNAME; BY &PID &INVESTIGATOR; %mend sortit; %sortit (ae,001,sarath); 4) Macros written to split the number of observations in a dataset %macro split (dsnorig, dsnsplit1, dsnsplit2, obs1); data &dsnsplit1; set &dsnorig (obs = &obs1); run; data &dsnsplit2; set &dsnorig (firstobs = %eval(&obs1 + 1)); run; %mend split; %split(sasuser.admit,admit4,admit5,2) 29. What is auto call macro and how to create a auto call macro? What is the use of it? How to use it in SAS with macros?

SAS Enables the user to call macros that have been stored as SAS programs. The auto call macro facility allows users to access the same macro code from multiple SAS programs. Rather than having the same macro code for in each program where the code is required, with an autocall macro, the code is in one location. This permits faster updates and better consistency across all the programs.Macro setup:The fist step is to set-up a program that contains a macro, desired to be used in multiple programs. Although the program may contain other macros and/or open code, it is advised to include only one macro. Set MAUTOSOURSE and SASAUTOS: Before one can use the autocall macro within a SAS program, The MAUTOSOURSE option must be set open and the SASAUTOS option should be assigned. The MAUTOSOURSE option indicates to SAS that the autocall facility is to be activated. The SASAUTOS option tells SAS where to look for the macros. For ex: sasauto=g:\busmeas\internal\macro\; 30. Why and How to Use %PUT Statement: %Put statement is similar to the PUT statement in data step, What it does is it writes text and values of macro variable after execution to the SAS System LOG. If you want to make sure your macro variable resolves as expected, you can make sure it with %PUT statement. Unique advantage of %PUT over PUT is you can use %PUT outside the data step whereas you cant with PUT. How to use %PUT: %let program=AE; %put program Name here as &program; Above %put statement resolves to %put Program Name here as AE; What can you do with %PUT: Numerous options are available for the %PUT statement. %PUT _all_: It prints all macro variables in the log that are available in all environments (global, local, user and automatic). %PUT _automatic_: It prints all the SAS defined automatic macro variables in the log. (ex: &sysdate, &systime ,%sysdsn, %syserr etc) %PUT _global_: It prints macro variables that are created by the user and available in all environments.

%PUT _local_: It prints macro variables that are created by the user and available only in the local environment. (couldnt be able use those macro variables outside the particular data step)

%PUT _user_: It prints macro variables that are created by the user in each environment. 31) How to know how &&var&i or &&dsn&i resolves? It is very confusing some times to tell rightaway how &&var&i or &&dsn&i get resolved... but here is the simple technique you can use to know.... ex: We generally use &&var&i or &&dsn&i these macro variables when we are using a %do loop... to execute same code n number of times. You have a dataset and it has 5 variables ... Patid sex age ethnic race wt ht; %macro doit; %do i=1 %to &nvars; &&var&i %end; %mend doit; So if the nvars value is 7, then the loop creates a macro variable list of &var1 &var2 &var3 &var4 &var5 &var6 &var7 which further get resolved to patid sex age ethnic race wt ht You can always use Macro debugging option SYMBOLGEN to see how each macro variable got resolved....

1. 2. 3.

What SAS statements would you code to read an external raw data file to a DATA step? How do you read in the variables that you need? Are you familiar with special input delimiters? How are they used?

4. If reading a variable length file with fixed input, how would you prevent SAS from reading the next record if the last variable didnt have a value? 5. 6. 7. 8. 9. What is the difference between an informat and a format? Name three informats or formats. Name and describe three SAS functions that you have used, if any? How would you code the criteria to restrict the output to be produced? What is the purpose of the trailing @? The @@? How would you use them? Under what circumstances would you code a SELECT construct instead of IF statements?

10. What statement do you code to tell SAS that it is to write to an external file? What statement do you code to write the record to the file? 11. If reading an external file to produce an external file, what is the shortcut to write that record without coding every single variable on the record? 12. If youre not wanting any SAS output from a data step, how would you code the data statement to prevent SAS from producing a set? 13. What is the one statement to set the criteria of data that can be coded in any step?

14. Have you ever linked SAS code? If so, describe the link and any required statements used to either process the code or the step itself. 15. How would you include common or reuse code to be processed along with your statements?

16. When looking for data contained in a character string of 150 bytes, which function is the best to locate that data: scan, index, or indexc? 17. If you have a data set that contains 100 variables, but you need only five of those, what is the code to force SAS to use only those variable? 18. Code a PROC SORT on a data set containing State, District and County as the primary variables, along with several numeric variables. 19. 20. 21. How would you delete duplicate observations? How would you delete observations with duplicate keys? How would you code a merge that will keep only the observations that have matches from both sets.

22. How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data set to a second data set, and the non-matches of the right-most data set to a third data set. 23. 24. 25. 26. 27. 28. 29. 30. 31. What is the Program Data Vector (PDV)? What are its functions? Does SAS Translate (compile) or does it Interpret? Explain. At compile time when a SAS data set is read, what items are created? Name statements that are recognized at compile time only? Identify statements whose placement in the DATA step is critical. Name statements that function at both compile and execution time. Name statements that are execution only. In the flow of DATA step processing, what is the first action in a typical DATA Step? What is _n_?

Das könnte Ihnen auch gefallen