BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Uzma1
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

7 REPLIES 7
ballardw
Super User

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?

Uzma1
Calcite | Level 5

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

ballardw
Super User

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?

Uzma1
Calcite | Level 5

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.

 

ballardw
Super User

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.

Uzma1
Calcite | Level 5

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

 

viviyeah
Fluorite | Level 6
Hi Uzma, have you figured out which one is the correct one? Thanks!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

Discussion stats
  • 7 replies
  • 2344 views
  • 1 like
  • 3 in conversation