Consideraciones finales
SISTEMAS DE GOBIERNO: EL PRESIDENCIALISMO
II. Instituciones políticas y neo-institucionalismo
D. BY DATE FORMATTED;
88. The following SAS program is submitted: DATA ONE;
DO i=1 TO 10;
PTOBS=CEIL(RANUNI(0)*TOTOBS); SET TEMP POINT=PTOBS NOBS=TOTOBS; OUTPUT;
END; STOP; RUN;
The SAS data set TEMP contains 2,500,000 observations.
Which one of the following represents the possible values for PTOBS? A. Any integer between 1 and 2,500,000
B. Any integer between 1 and 10 C. Any real number between 0 and 1
D. Any real number between 1 and 2,500,000
89. The following SAS program is submitted: %MACRO EXECUTE;
< insert statement here >
PROC PRINT DATA=SASUSER.HOUSES; RUN;
%END; %MEND;
Which of the following completes the above program so that it executes on Tuesday? A. %IF “&SYSDAY” = Tuesday %THEN %DO;
B. %IF &SYSDAY = ‘Tuesday’ %THEN %DO; C. %IF &SYSDAY = Tuesday %THEN %DO; D. %IF ‘&SYSDAY’ = ‘Tuesday’ %THEN %DO;
90. The following SAS program is submitted: PROC SORT DATA=SALES TAGSORT;
BY MONTH YEAR; RUN;
Advanced SAS 9 Exam Prep: A00-212 | Prepared for Sritej Gunta A. CPU usage only
B. I/O and CPU usage C. Temporary disk usage D. I/O usage only
81. (D) The macro program TEST is created with a positional parameter called PARM. When the macro program TEST is called, it replaces the positional parameter with PRINT and during execution of the macro, PRINT replaces the macro variable &PARM for a final result of PROC PRINT.
When the MPRINT option is specified, the text that is sent to the SAS compiler as a result of macro execution is printed to the SAS log.
You may want to specify the MPRINT system option if: you have a SAS syntax error or execution error, or you want to see the generated SAS code.
In this example, the printed text to the SAS log would appear as follows: MPRINT(TEST): PROC PRINT DATA=SASHELP.PRDSALE;
MPRINT(TEST): RUN;
82. (B) 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.
To do this, you specify the KEY= option in the SET statement to use an index to retrieve observations from the input data set that have key values equal to the key variable value that is currently in the program data vector (PDV). The syntax is as follows:
SET SAS-data-set-name KEY=index-name;
Where index-name is the name of an index that is associated with the SAS-data-set-name data set.
83. (B) The DESCRIBE TABLE statement writes a CREATE TABLE statement to the SAS log for the table specified in the DESCRIBE TABLE statement, regardless of how the table was originally created (for example, with a DATA step). If applicable, SAS data set options are included with the table definition. If indexes are defined on columns in the table, then CREATE INDEX statements for those indexes are also written to the SAS log.
To create the example generated output, imitate the following: PROC SQL;
DESCRIBE TABLE SASHELP.CLASS; QUIT;
84. (D) When the MPRINT option is specified, the text that is sent to the SAS compiler as a result of macro execution is printed to the SAS log.
You may want to specify the MPRINT system option if: you have a SAS syntax error or execution error, or you want to see the generated SAS code.
85. (D) The DICTIONARY.TABLES table contains detailed information about tables. Dictionary column names are specified in the SELECT statement and the Dictionary table name, DICTIONARY.TABLES, is specified in the FROM clause.
In this example, the asterisk (*) selects all column names for all tables in SAS.
If you want to specify a particular library instead of all libraries, you must specify the library name in uppercase letters with a WHERE clause and enclose it in quotation marks. For example, to select all columns from just the WORK library: PROC SQL; SELECT * FROM DICTIONARY.TABLES WHERE LIBNAME=’WORK’; QUIT;
86. (B) Notice that the PROC SQL will have two variables in the output (REP and AVERAGE) as a result of the SELECT statement.
The next thing to notice is that this program is going to group values in the REP column together (SMITH and JONES). A HAVING clause works with the GROUP BY clause to restrict the groups that are displayed in the output, based on one or more specified conditions.
In this example, we have our grouped values (SMITH and JONES), and the output will depend on whether or not those groups meet a specified condition.
The AVERAGE value for the SMITH group is 400. The AVERAGE value for the JONES group is 100. The average of the COST variable for all observations in data set ONE is 280.
So, in order to print just the SMITH group with its AVERAGE value, you can apply the following clause: HAVING AVG(COST) > (SELECT AVG(COST) FROM ONE);
Note: The WHERE clause can’t process calculated variables and is invalid.
87. (A) First, notice the FORMAT statement. It assigns a format of QTR. (which must have been previously created as part of a FORMAT procedure) to the variable DATE.
When the GROUPFORMAT option is used, the data set must be sorted by the GROUPFORMAT variable or grouped by the formatted values of the GROUPFORMAT variable.
The GROUPFORMAT option uses the formatted values of a variable instead of the internal values to determine where a BY group begins and ends, and how FIRST.variable and LAST.variable are computed. The syntax is as follows:
BY variable(s) GROUPFORMAT;
Where variable(s) names each variable by which the data set is sorted or indexed.
88. (A) The CEIL function returns the smallest integer that is greater than or equal to the argument, fuzzed to avoid unexpected floating-point results. The syntax is as follows:
CEIL (argument)
Where argument specifies a numeric constant, variable, or expression.
You can use the CEIL function in conjunction with the RANUNI function to generate a random integer.
The CEIL function returns the smallest integer that is greater than or equal to the argument. Therefore, if you apply the CEIL function to the result of the RANUNI function, you can generate a random integer.
With this knowledge, you can look at the assignment statement that creates the variable PTOBS. TOTOBS is a variable equal to the total number of observations in the data set. The data set is described as having 2.5 million
observations so PTOBS can be any random integer between 1 and 2,500,000.
89. (C) SAS creates and defines several automatic macro variables for you. Automatic macro variables contain information about your computing environment, such as the date and time of the session, and the version of SAS you are running. These automatic variables: are created when SAS is invoked, are global (always available), are usually assigned values by SAS, and can be assigned values by the user in some cases.
SYSDAY is one such automatic SAS macro variable with a value equal to the day of the week of the SAS invocation. In this example, options (A) and (D) can be excluded because no quotes should be placed around macro variables. Option (B) can be excluded because all macro variables are character strings, therefore it is unnecessary to quote the value Tuesday.
What this program does is, when the macro program EXECUTE is called, it executes the program. It resolves the value of &SYSDAY, and if that value is equal to Tuesday then the PRINT procedure is executed.
90. (C) The TAGSORT option can be used to sort a large data set. The TAGSORT option stores only the BY variables and the observation numbers in temporary files. The BY variables and the observation numbers are called tags. At the
Advanced SAS 9 Exam Prep: A00-212 | Prepared for Sritej Gunta completion of the sorting process, PROC SORT uses the tags to retrieve records from the input data set in sorted order.
When the total length of the BY variables is small compared to the record length, TAGSORT reduces temporary disk usage considerably because sorting just the BY variables means sorting much less data. However, processing time is usually higher than if a regular sort is used because TAGSORT increases CPU time and I/O usage in order to save memory and disk space.
91. The following SAS program is submitted: %LET DEPT=prod;
%LET PROD=merchandise;
The following message is written to the SAS log: The value is “merchandise”
Which SAS system option writes this message to the SAS log? A. %PUT The value is “&DEPT”
B. %PUT The value is “&&DEPT”; C. %PUT The value is “&&&DEPT”; D. %PUT The value is %QUOTE(&&&DEPT);
92. What is generated as a result of submitting the RANUNI function with a seed of 123? A. A random number between 0 and 123
B. A different sequence of random numbers with each program execution C. A consistent sequence of random numbers with each program execution D. A missing value because 123 is an invalid argument for the RANUNI function
93. The following SAS program is submitted: < insert statement here >
%LET DEVELOPMENT=ontime;
PROC PRINT DATA=SASUSER.HIGHWAY; TITLE1 “For &DEPT”;
TITLE2 “This project was completed &DEVELOPMENT”; RUN;
Which one of the following statements completes the above and resolves TITLE1 to “For research&development”? A. %LET DEPT=%STR(research&development);
B. %LET DEPT=%NRSTR(research&development); C. %LET DEPT=%STR(research%&development); D. %LET DEPT=%NRSTR(research%&development);
94. Which one of the following statements is true?
A. The WHERE statement selects observations before they are brought into the PDV B. The WHERE statement can be executed conditionally as part of an IF statement C. The subsetting IF statement works on observations before they are read into the PDV D. The WHERE and subsetting IF statements can be used interchangeably in all SAS programs
95. Which one of the following should be avoided when creating and using an SQL procedure view? A. Using a HAVING clause
B. Creating views on tables whose structures remain constant C. Using summary functions
96. Given the following SAS statement: %LET IDCODE=PROD567;
Which one of the following statements stores the value 567 in the macro variable CODENUM? A. %LET CODENUM=SUBSTR(&IDCODE, LENGTH(&IDCODE)-3);
B. %LET CODENUM=%SUBSTR(&IDCODE, %LENGTH(&IDCODE)-3); C. %LET CODENUM=%SUBSTR(&IDCODE, %LENGTH(&IDCODE)-2); D. %LET CODENUM=SUBSTR(&IDCODE, LENGTH(&IDCODE)-2);
97. The variable attributes of SAS data sets ONE and TWO are given below: ONE TWO
# VARIABLE TYPE LEN POS # VARIABLE TYPE LEN POS - --- ---- --- --- - --- ---- --- --- 2 SALES NUM 8 8 2 BUDGET NUM 8 8 1 YEAR NUM 8 0 3 SALES CHAR 8 16 1 YEAR NUM 8 0
Data set ONE contains 100 observations. Data set TWO contains 50 observations. Both data sets are sorted by the variable YEAR.
The following SAS program is submitted: DATA THREE;
MERGE ONE TWO; BY YEAR; RUN;
Which one of the following is the result of the program execution? A. No messages are written to the SAS log
B. Data set THREE is created with two variables and 50 observations C. ERROR and WARNING messages are written to the SAS log
D. Data set THREE is created with three variables and 100 observations
98. The SAS data sets ONE and TWO are given below: ONE TWO
NUM CHAR1 NUM CHAR2 --- --- --- --- 1 A1 2 X1 1 A2 2 X2 2 B1 3 Y 2 B2 5 V 4 D
The following SAS program is submitted creating the output table THREE: PROC SQL;
CREATE TABLE THREE AS SELECT ONE.NUM, CHAR1, CHAR2 FROM ONE, TWO
WHERE ONE.NUM=TWO.NUM; QUIT;
THREE NUM CHAR1 CHAR2 --- --- --- 2 B1 X1 2 B1 X2 2 B2 X1 2 B2 X2
Which one of the following DATA step programs creates an equivalent SAS data set THREE? A. DATA THREE;
SET ONE;
Advanced SAS 9 Exam Prep: A00-212 | Prepared for Sritej Gunta SET TWO(RENAME=(NUM=NUM2)) POINT=i NOBS=NUMOBS;
IF NUM2=NUM THEN OUTPUT; END; DROP NUM2; RUN; B. DATA THREE; SET ONE; SET TWO; BY NUM; RUN; BY NUM; RUN; C. DATA THREE; SET ONE; SET TWO; BY NUM; RUN;
MERGE ONE TWO; BY NUM; RUN; D. DATA THREE;
MERGE ONE TWO; BY NUM; RUN;
99. The following SAS FORMAT procedure is submitted: PROC FORMAT LIB=SASUSER;
VALUE TEMPC
LOW -< 0 =’BELOW FREEZING’ 0 -< 5 =’COLD’
5 -< 10 =’MILD’ 10 -< 15 =’WARM’ 15 -< HIGH =’HOT’; RUN;
How is the value 10 displayed when the format TEMPC is applied? A. 10
B. MILD