• No se han encontrado resultados

Sistemas presidenciales en su contexto

Consideraciones finales

SISTEMAS DE GOBIERNO: EL PRESIDENCIALISMO

V. Tipos de presidencialismo y contexto

2. Sistemas presidenciales en su contexto

F 150 F 210 B. CATEGORY EARNINGS --- --- M . M 110 F 150 F 210

C. CATEGORY SALARY BONUS EARNINGS --- --- --- --- M 200 . 200 M 100 10 110 F 100 50 150 F 200 10 210 D. CATEGORY SALARY BONUS EARNINGS

--- --- --- --- M 200 . . M 100 10 110 M 200 . 200 M 100 10 110 F 100 50 150 F 200 10 210

109. The following SAS program is submitted: DATA TWO; Y=’2’; RUN; %LET X=10; %LET VAR=Y; DATA ONE;

SET TWO (KEEP=&VAR); Z=&VAR * &X;

RUN;

Which one of the following is the value of the variable Z when the program finishes execution? A. _ERROR_

B. 20 (As a numeric) C. 20 (As a character) D. . (Missing numeric)

110. Which of the following statements correctly creates a DATA step variable named Price and assigns to it the value of the macro variable daily_fee during DATA step execution?

A. price=&daily_fee; B. price=symget(daily_fee); C. price=symget(&daily_fee); D. price=symget(“daily_fee”);

101. (B) When you use the DATA _NULL_ statement, SAS processes the DATA step without writing observations to a data set. Using the DATA _NULL_ statement can considerably increase program efficiency.

The BY statement in a DATA STEP applies only to the SET, MERGE, or UPDATE statement that precedes it in the DATA step, and only one BY statement can accompany each of these statements in a DATA step.

The data sets that are listed in the SET, MERGE, or UPDATE statements must be sorted by the values of the variables that are listed in the BY statement or have an appropriate index. As a default, SAS expects the data sets to be arranged in ascending numeric order or in alphabetical order.

Now, macro variables are part of the SAS macro facility, which is a tool for extending and customizing SAS and for reducing the amount of program code you must enter to perform common tasks. Whether automatic or user-defined, a macro variable is independent of a SAS data set and contains one text string value that remains constant until you change it.

So, when you execute your code, SAS first scans for ampersands and percentage signs (macro triggers) and resolves any necessary variables independent of the DATA steps. It then takes those values and stores them in either the local or global symbol table.

As mentioned earlier, _NULL_ in a DATA statement means that nothing is written to any data set and because the %LET statement resolves independent of the DATA step, the DO loop doesn’t do anything.

The entire program produces nothing, and the %LET statement could have been written anywhere in the editor window and it still would have resolved to SALES.

102. (A) You can use multiple SET statements to combine data from multiple data sets if you want to combine only data from observations that have matching values for particular variables.

You specify the KEY= option in the SET statement to use an index to retrieve observations from the input data set that has key values equal to the key variable value that is currently in the program data vector (PDV).

Note: To use the SET statement with the KEY= option to perform a lookup operation, your lookup values must be stored in a SAS data set that has an index. This technique is only appropriate when you are working with one-to-one matches, and you can use it with a lookup table of any size. It is possible to return multiple values with this technique, and you can use other DATA step syntax with it as well.

103. (D) The _NULL_ data set doesn’t write anything to a SAS data set, but it does execute. In its execution it creates a data set variable called DATE with a numeric value that is equal to the number of days since January 1, 2000 (14610). It then, using the CALL SYMPUT routine, creates a global macro variable called DATE and assigns a value the same as the data set variable DATE (14610).

%Y2KOPT(&DATE); calls the Y2KOPT macro and applies the newly created DATE macro variable. It matches the 14610 within the %IF/%THEN and gets applied on the first iteration of the DO loop with a YEARCUTOFF of 2000.

Note: If the data set variable DATE had instead been given a value of ‘31DEC1999’D then the YEARCUTOFF would have instead been 1900.

104. (D) When a lookup operation depends on more than one numerical factor, you can use a multidimensional array. The syntax is as follows:

ARRAY array-name {rows,cols…} <$> <length> <array-elements> <(initial values)>;

As you can see from the question, the array POINTS is assigned two rows and three columns for a total of six elements.

Note: The keyword _TEMPORARY_ may be used instead of array-elements to avoid creating new data set variables. Only temporary array elements are produced as a result of using _TEMPORARY_.

105. (B) The first thing SAS does is make use of the FROM clause and access the data set ONE. The next thing it does is extract the variables COUNTRY and CITY, then creates a new variable called TOTAL.

The GROUP BY clause is used in queries that include one or more summary functions. Summary functions produce a statistical summary for each group that is defined in the GROUP BY clause.

So, first the table is grouped by country. After that initial grouping, it is grouped again by city. From this point, the variable TOTAL displays the value of the sum of each of these groups’ visit.

The ORDER BY clause then sorts the rows that the query returns by the value(s) of the specified column(s).

First, these groups are sorted by the variable COUNTRY. By default, they are sorted in ascending order. So, UK comes before USA. Then are then sorted further by TOTAL in descending order. That’s why, for each group, the highest TOTAL is listed first.

Note: If the keyword DESC had not been utilized, TOTAL would have sorted (after COUNTRY) in ascending order. This would have resulted in the flip-flop of LONDON 20 with MARLOW 10 and BOSTON 30 with DALLAS 20.

Advanced SAS 9 Exam Prep: A00-212 | Prepared for Sritej Gunta

106. (B) The hash object provides an efficient, convenient mechanism for quick data storage and retrieval.

Unlike an array, which uses a series of consecutive integers to address array elements, a hash object can use any combination of numeric and character values as addresses. A hash object can be loaded from hard-coded values or a SAS data set, is sized dynamically, and exists for the duration of the DATA step.

107. (D) SAS creates and defines several automatic macro variables. Automatic macro variables contain information about your computing environment, such as the date and time of session, and the version of SAS you are running.

Some automatic variables have values that automatically change based on submitted SAS statements.

SYSERR is one such automatic variable that contains a return code status that is set by the DATA step and some SAS procedures to indicate if the step or procedure executed successfully.

108. (B) The addition sign (+) acts as an operator to perform a calculation between to variable values (SALARY and BONUS). However, when you use an arithmetic expression (+, -, *, /), the SQL procedure always sets the result of the

expression to missing (.). If you use that result in another expression, the next result will be valued as missing (.) as well.

Note: This method of treating missing values is called propagation of missing values.

109. (B) In data set TWO the variable Y is assigned a character value of 2. Additionally, via the %LET statement, there is a global macro variable called VAR with a value of Y.

The data step, which creates the data set ONE, has a KEEP= option on the SET statement which includes the macro variable VAR which resolves to Y. This instructs the input data set to keep the Y variable from data set TWO. The Z variable is then created by multiplying the values of two macro variables which are considered character values. SAS, though, is able to temporarily convert these values to numeric in order to perform the required operation.

110. (D) The SYMGET function returns the value of an existing macro variable. SYMGET(macro-variable)

Where macro-variable can be specified as one of the following: a macro variable name (enclosed in quotation marks), a DATA step variable name whose value is the name of a macro variable, or a DATA step character expression whose value is the name of a macro variable

111. The SAS data set ONE is given below: JOB LEVEL SALARY

--- --- --- ACC 2 300 SEC 1 100 SEC 2 200 MGR 3 700 ACC 1 . ACC 3 . MGR 2 400

The SAS data set TWO is created: JOB LEVEL BONUS

--- --- --- ACC 2 30 MGR 3 70 MGR 2 40

A. PROC SQL;

CREATE TABLE TWO AS

SELECT JOB, LEVEL, SALARY * 0.1 AS BONUS FROM ONE

WHERE BONUS > 20; QUIT;

B. PROC SQL;

CREATE TABLE TWO AS

SELECT JOB, LEVEL, SALARY * 0.1 AS BONUS FROM ONE

WHERE SALARY > 20; QUIT;

C. PROC SQL;

CREATE TABLE TWO AS

SELECT JOB, LEVEL, SALARY * 0.1 AS BONUS FROM ONE

WHERE CALCULATED SALARY * 0.1 > 20; QUIT;

D. PROC SQL;

CREATE TABLE TWO AS

SELECT JOB, LEVEL, SALARY * 0.1 AS BONUS FROM ONE

WHERE CALCULATED BONUS > 20; QUIT;

112. The following SAS program is submitted: %MACRO LOCATION; DATA _NULL_; CALL SYMPUT(‘DEPT’,’SALES’); RUN; %LET COUNTRY=GERMANY; %PUT _GLOBAL_; %MEND; %LET COMPANY=ABC; %LOCATION

Which macro variables are written to the SAS log? A. COMPANY and DEPT only

B. COMPANY, COUNTRY, and DEPT C. COMPANY only

D. COMPANY and COUNTRY only

113. The following SAS program is submitted: DATA TEMP (< insert option here >); INFILE ‘RAWDATA’;

INPUT X $ Y Z; RUN;

RAWDATA is a file reference to an external file that is ordered by the variable X. Which option specifies how the data in the SAS data set TEMP will be sorted? A. ORDEREDBY=X

B. GROUPBY=X