Explanation: As there are in total 4 rows (So we have observed 4 employee information and for each employee 3 attributes are given, which we can say this are variable.
Question :
A raw data record is listed below: --------10-------20-------30 1999/10/25 The following SAS program is submitted: data projectduration; infile 'file-specification'; input date $ 1 - 10;
run; Which one of the following statements completes the program above and computes the duration of the project in days as of today's date?
Explanation: : It cannot be a PUT function because it converts Numeric to Char values. For calculations we need Num variable => So INPUT function, also year is the first mentioned value so answer is D.
Input function converts character to numeric, put funtion converts numeric to char ...so here date is given as character,,input function and date is in the form of yymmdd10.
Question :
The following SAS program is submitted: data work.month; date = put('13mar2000'd,ddmmyy10.); run; Which one of the following represents the type and length of the variable DATE in the output data set?
Correct Answer : Get Lastest Questions and Answer : put function converts num to char thus date be displayed as 03/13/2000, taking up 10 bytes. ddmmyy10. formats date to be 10 bytes in length i.e dd/mm/yyyy, and 'put' converts value into a character type
use proc contents data=month; run; you will get to know how the answer is D.
1. The by statement in the DATA step causes a syntax error. 2. The statement Payroll+(MonthlyWageRate*12); in the data step causes a syntax error. 3. Access Mostly Uused Products by 50000+ Subscribers 4. The values of the variable Payroll represent a monthly total for all values of WAGERATE in the WORK.SALARY data set.
1. proc print data = sasuser.houses; where price lt 60000; where price gt 100000; run; 2. proc print data = sasuser.houses; where price lt 60000 or price gt 100000; run; 3. Access Mostly Uused Products by 50000+ Subscribers where price lt 60000 and price gt 100000; run; 4. proc print data = sasuser.houses; where price lt 60000 or where price gt 100000; run; Ans : 2 Exp : 'OR' gives either of one condition whereas we need both condition results , so answer is B. 'OR' means either one of d conditions shd b true. In this case both the conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the observations in which both the conditions are true at d same time. ie. the obs where the price is ln 60000 and also the preice is gt100000. Hence answer is not correct.
'OR' means either one of d conditions shd b true. In this case both the conditions are true, so it will give desired observations. Here if we use 'AND' it will search for the observations in which both the conditions are true at d same time. ie. the obs where the price is ln 60000 and also the preice is gt100000. Hence answer is not correct.
Question : The value is stored in a numeric variable. Which one of the following SAS formats is used to display the value as $110,700.00 in a report? 1. comma8.2 2. comma11.2 3. Access Mostly Uused Products by 50000+ Subscribers 4. dollar11.2 Ans : 4
Exp : the total width is 11 not 8, so it comes down to either of dollar11.2 or comma11.2. But comma11.2 does not insert dollar sign along with comma. So the answer is 4.
when you use comma11.2 as an informat, sas removes dollar signs, commas and percent signs(if they exist in the value you are trying to read) whereas the format dollar11.2 inserts a dollar sign and a comma.
Question : The SAS data set BANKS is listed below: BANKS name rate FirstCapital 0.0718 DirectBank 0.0721 VirtualDirect 0.0728 The following SAS program is submitted: data newbank; do year = 1 to 3; set banks; capital + 5000; end; run; Which one of the following represents how many observations and variables will exist in the SAS data set NEWBANK?
The four variables are Name, Rate, Year, Capital. we have three variables in the dataset, when we set the dataset in the do loop it reads the three observations from data set banks (as the set statement is called thrice) when they do loop terminates the value for year is 4 and the implicit output is executed at run;
this causes the observation to be written in the new data set. since all three observations are read in the the do loop the data step gets terminated and only one observations is written since we have two additional variables in the data step year and capital we get total of 4 variables
Question :
The following SAS program is submitted: data work.clients; calls = 6; do while (calls le 6); calls + 1; end; run; Which one of the following is the value of the variable CALLS in the output data set?
DO WHILE The while test is evaluated at the top of the loop.
DO UNTIL The until test is evaluated at the bottom of the loop.
DO WHILE (evaluates at the top of the loop) Now, calls=6 is equal to 6 therefore calls le 6 is TRUE. DO LOOP is executed. So, calls = calls +1 = 7
Now, calls=7 is greater than 6 therefore calls le 6 is FALSE. DO LOOP is not executed.
Hence, the value of calls remains 7
here, note that the operator is LE (less than or equal to). So the condition is true the first time. Calls = 6 and it becomes Calls + 1 => 6+1 = 7.
The loop stops executing as the value of calls becomes greater than 6. Thus, output is 7.
Question :
The following SAS program is submitted: data work.pieces; do while (n lt 6); n + 1; end; run; Which one of the following is the value of the variable N in the output data set?
DO UNTIL The until test is evaluated at the bottom of the loop.
DO WHILE (evaluates at the top of the loop). [Remember: SAS gives value starting from 0, if value not defined] n=0, 1, 2, 3, 4, 5 than n is lt (less than) 6 therefore n lt 6 is TRUE. DO LOOP is executed. Adding plus 1 at every iteration. Now, when n=6 at top, it is not less than 6 therefore condition n lt 6 is FALSE. DO LOOP is not executed. Hence, the value of n remains 6
because of n+1 statement we assume a implicit retain n 0; statment. First loop (0 lt 6) => true => n = 1 Second loop (1 lt 6) => true => n= 2 ...... last loop (6 lt 6) => false => do while exits and pdv writes 6 as value of n in output dataset.
Question :
Suppose the YEARCUTOFF= system option is set to 1920. An input file contains the date expression 12/08/1925, which is being read with the MMDDYY8. informat. Which date will appear in your data?
1. 08DEC1920 2. 08DEC1925 3. Access Mostly Uused Products by 50000+ Subscribers 4. 08DEC2025 Ans : 3 Exp : The w value of the informat MMDDYY8. is too small to read the entire value, so the last two digits of the year are truncated. The last two digits thus become 19 instead of 25. Because the YEARCUTOFF= system option is set to 1920, SAS interprets this year as 2019. To avoid such errors, be sure to specify an informat that is wide enough for your date expressions
Question :
Suppose your program creates two variables from an input file. Both variables are stored as SAS date values: FirstDay records the start of a billing cycle, and LastDay records the end of that cycle. The code for calculating the total number of days in the cycle would be:
1. TotDays=lastday-firstday; 2. TotDays=lastday-firstday+1; 3. Access Mostly Uused Products by 50000+ Subscribers 4. You cannot use date values in calculations. Ans : 2 Exp : To find the number of days spanned by two dates, subtract the first day from the last day and add one. Because SAS date values are numeric values, they can easily be used in calculations
Question :
You can position the input pointer on a specific record by using
Ans : 3 Exp : Information for one observation can be spread out over several records. You can write one INPUT statement that contains line pointer controls to specify the record(s) from which values are read.
Question : When you are creating a custom format using FORMAT procedure, than which of the following statement is correct?