In the exam some questions ask to provide a line of code and " do not include leading or trailing blanks in your answer"
Which format is correct?
1. BY siteid
or
2. bysiteid
Thanks
If the file is old enought the document may have gone through some formatting changes. It is possible that there was originally a tab or other character between words that got lost in an update. Especially if the document was originally prepared in one word processor and then moved to a different one entirely such as Word Perfect to Word.
Run the code with the different responses offered. If the "result" is incorrect for the one that the document says is correct bring it to the attention of whoever provided the document. Show that person logs, especially if there are errors or interesting messages, and proc print output. If you get the "correct" result then bring that log and those results as well to show the correction needed.
I think you are skipping some information. Such what is the specific question. You posted what appears to be a generic instruction that could have multiple interpretations with out an exact question.
Is there a custom format defined with Proc Format involved? Is there a variable created/assigned/modified named BYSITEID? Any specific values mentioned? Any specific operations to be performed? Is this supposed to be in data step code or procedure?
Heres an example question
Given the following data set work.vs
Subjid site visit temp
00123 3 4 98.6
00123 3 4 .
00123 3 5 97.9
00123 3 5 98.9
00123 3 6 .
data work.vs1;
( insert code here)
set work.vs;
if temp ne . then old_temp=temp;
else temp = old_temp;
run;
In the space below, enter the line of code that completes the program ( Case is ignored. Do not add leading or trailing spaces to your answer)
I believe the answer should be retain old_temp;
My confusion is whether to write it as retainold_temp; OR retain old_temp;
Hope it makes sense.
Thanks
Uzma
Now the question is "complete the program to do what"?
All of the SAS keywords or instructions are going to want a space (usually) or (), to include values/variables, to process. Other wise additional text will likely create a new variable that you don't expect even though no error.
Why not try the code a see the results?
This problem is to impute LOCF.
Complete the program to " create a new data set that carries forward the previous value of temp when the value is missing."
I am working through material provided by my company and the answer says "retainoldtemp" . That answer is wrong if I code it on 9.2 and 9.4. The test is based off 9.0.
That does not make sense as the retain keyword will need a space after the next word.
A couple other questions have similar answers. "bysiteid" when it should be "by siteid"
The instructions about no spaces ( "Case is ignored. Do not add leading or trailing spaces to your answer" ) and these answers make me wonder what the right response is. Does it mean no spaces before and after the text/string of the answer. Or, the system does not recognize spaces correctly so no spaces even within the answer.
If the file is old enought the document may have gone through some formatting changes. It is possible that there was originally a tab or other character between words that got lost in an update. Especially if the document was originally prepared in one word processor and then moved to a different one entirely such as Word Perfect to Word.
Run the code with the different responses offered. If the "result" is incorrect for the one that the document says is correct bring it to the attention of whoever provided the document. Show that person logs, especially if there are errors or interesting messages, and proc print output. If you get the "correct" result then bring that log and those results as well to show the correction needed.
Hi ballardw,
The issue seems to be, as you mentioned, an error local to this document.
I passed the test this week. There were questions that require typing in a line of code to complete a given program. Instructions include "code should be in the correct SAS syntax".
My confusion about trailing / leading blanks and spaces is 100% irrelevant.
Thanks for your input.
Uzma1
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Need courses to help you with SAS Life Sciences Analytics Framework, SAS Health Cohort Builder, or other topics? Check out the Health and Life Sciences learning path for all of the offerings.