if you put the retain statement it will stop once reads the missing value the totquantity will be missing value (. A is the correct one, when we put the statement totquantity + quantity, it initializes to zero in the first iteration and adds the quantity and gets the fist totquantity. Missing Values: When Missing Values are Generated by SAS Expression cannot ignore missing value, but the SUM function and statement can. retain totquantity 0 totquantity = totquantity + quantity Correct Answer : Get Lastest Questions and Answer : Explanation: data aa x=. Access Mostly Uused Products by 50000+ Subscribers sum totquantity 4. totquantity = sum(totquantity + quantity) 3. 1941 1 The following SAS program is submitted and references the raw data file above: data coins infile 'file-specification' input year quantity run Which one of the following completes the program and produces a non-missing value for the variable TOTQUANTITY in the last observation of the output data set? 1. " - Sas help and documentation Question : A raw data file is listed below: -10-20-30 11 1.
![sas interview questions retain sas interview questions retain](https://static.javatpoint.com/interview/images/sas-interview-questions-q4.png)
SAS treats an expression that produces a missing value as zero. Tips:The expression is evaluated and the result added to the accumulator variable. To initialize a sum variable to a value other than 0, include it in a RETAIN statement with an initial value. The variable's value is retained from one iteration to the next, as if it had appeared in a RETAIN statement. Tips:The variable is automatically set to 0 before SAS reads the first observation. First part "It adds the value of an expression to an accumulator variable." "RETAIN variable specifies the name of the accumulator variable, which contains a numeric value.
#SAS INTERVIEW QUESTIONS RETAIN UPDATE#
The RETAIN statement - is a compile-time only statement that creates variables if they do not already exist - initializes the retained variable to missing before the first execution of the DATA step if you do not supply an initial value - has no effect on variables that are read with SET, MERGE, or UPDATE statements. Correct Answer : Get Lastest Questions and Answer : Explanation: It adds the value of an expression to an accumulator variable and ignores missing values. It adds the value of an expression to an accumulator variable and ignores missing values. Access Mostly Uused Products by 50000+ Subscribers 4. It is only valid in conjunction with a SUM function.
![sas interview questions retain sas interview questions retain](https://sascrunch.com/wp-content/uploads/2020/10/i6001_orig.png)
It can be used to assign an initial value to _N_. Question : Which one of the following is true of the RETAIN statement in a SAS DATA step program? 1.