I feel like the practice exam must have been reviewed a thousand times for accuracy, so I feel silly asking this, but I really feel like the answer to Question 9 should be Bobby Bonilla. The question asks for the value of the NewName variable for observation 28 in the output data set:
The entire question is:
Write a SAS program that will:
Use PROC FCMP to create a user-defined function called ReverseName to convert the variable name values from lastname, firstname to firstname lastname (Example: convert Wei, Zhang to Zhang Wei) Store the function in work.functions.dev.
Use the following formula for the conversion:catx(" ", scan(name,2,","),scan(name,1,","))
Create a new data set work.ACT01.
Create this data set from the cert.names01 data set.
Use the ReverseName function to create a new variable newName from the name variable.
work.ACT01 should contain both the name and newName variables.
When finished, sort the new data set by the newName variable in ascending order.
The correct code is below and the names.01 dataset is attached here.
options cmplib=work.functions;
proc fcmp outlib=work.functions.dev;
function ReverseName(name $) $40;
return(catx(" ", scan(name,2,","),scan(name,1,",")));
endsub;
quit;
data work.act01;
set cert.names01;
newName=ReverseName(name);
run;
Can someone try this and let me know if I am missing something? The answer key states that the correct response is "Bo Diaz" but that is the value for observation 79.
Thanks!
@TheresaM wrote:
I feel like the practice exam must have been reviewed a thousand times for accuracy, so I feel silly asking this, but I really feel like the answer to Question 9 should be Bobby Bonilla. The question asks for the value of the NewName variable for observation 28 in the output data set:
The entire question is:
Write a SAS program that will:
Use PROC FCMP to create a user-defined function called ReverseName to convert the variable name values from lastname, firstname to firstname lastname (Example: convert Wei, Zhang to Zhang Wei) Store the function in work.functions.dev.
Use the following formula for the conversion:catx(" ", scan(name,2,","),scan(name,1,",")) Create a new data set work.ACT01.
Create this data set from the cert.names01 data set. Use the ReverseName function to create a new variable newName from the name variable. work.ACT01 should contain both the name and newName variables. When finished, sort the new data set by the newName variable in ascending order.The correct code is below and the names.01 dataset is attached here.
options cmplib=work.functions; proc fcmp outlib=work.functions.dev; function ReverseName(name $) $40; return(catx(" ", scan(name,2,","),scan(name,1,","))); endsub; quit; data work.act01; set cert.names01; newName=ReverseName(name); run;Can someone try this and let me know if I am missing something? The answer key states that the correct response is "Bo Diaz" but that is the value for observation 79.
Thanks!
Check the OBSERVATION NUMBER AFTER SORTING
@TheresaM wrote:
I feel like the practice exam must have been reviewed a thousand times for accuracy, so I feel silly asking this, but I really feel like the answer to Question 9 should be Bobby Bonilla. The question asks for the value of the NewName variable for observation 28 in the output data set:
The entire question is:
Write a SAS program that will:
Use PROC FCMP to create a user-defined function called ReverseName to convert the variable name values from lastname, firstname to firstname lastname (Example: convert Wei, Zhang to Zhang Wei) Store the function in work.functions.dev.
Use the following formula for the conversion:catx(" ", scan(name,2,","),scan(name,1,",")) Create a new data set work.ACT01.
Create this data set from the cert.names01 data set. Use the ReverseName function to create a new variable newName from the name variable. work.ACT01 should contain both the name and newName variables. When finished, sort the new data set by the newName variable in ascending order.The correct code is below and the names.01 dataset is attached here.
options cmplib=work.functions; proc fcmp outlib=work.functions.dev; function ReverseName(name $) $40; return(catx(" ", scan(name,2,","),scan(name,1,","))); endsub; quit; data work.act01; set cert.names01; newName=ReverseName(name); run;Can someone try this and let me know if I am missing something? The answer key states that the correct response is "Bo Diaz" but that is the value for observation 79.
Thanks!
Check the OBSERVATION NUMBER AFTER SORTING
Yes yes yes! I knew that I was missing something, despite rereading the question a dozen times. This is the type of thing I need to watch out for during the exam. Thank you @ballardw !!
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.