BookmarkSubscribeRSS Feed
TimWright22
Fluorite | Level 6

I am about to take the certification exam for clinical trials programming. There is one question which I will have to enter, instead of multiple choice, that uses a question mark instead of an "-" for subtraction of macro variables. For example, inside of a user created macro, the difference between &visit and &rand is listed as &visit ?&rand +1; 

It seems like the answer should be &visit - &rand+1;

 

If it helps, this is within the user defined macro studyday.

 

%macro studyday(rand,visit);

&visit ?&rand;

%mend studyday;

 

For the same test, the answers for the practice examps do not have a " " between words. For example, one answer is RETAINSUBJECTID. I'm not so concerned about these. But if anyone wants to recommend whether I should say "retainsujectid" or "retain subjectid", that would be welcome.  

8 REPLIES 8
PaigeMiller
Diamond | Level 26

You could simply write the code and see for yourself.

 

%macro test;
%let visit = 222;
%let rand= 17;
%let oink = &visit-&rand+1;
%let oink2 = &visit ? &rand +1;
%put &=oink;
%put &=oink2;
%mend;

%test

 

The two different macro statements are not the same, neither of them really produces a difference in the macro processor, although if you use the macro variables in a DATA step you could wind up with a difference.

 

%macro test2;
%let visit = 222;
%let rand= 17;
%let oink = &visit-&rand+1;
%let oink2 = &visit ? &rand +1;
%put &=oink;
%put &=oink2;
data abc;
    difference=&oink;
run;
data abc2;
    difference=&oink2;
run;
%mend;

options mprint;
%test2

 

Another possiblity where ? is correct and – is not correct.

 

%macro test3;
%let visit = name;
%let rand= 'Jane';
%let oink = &visit-&rand+1;
%let oink2 = &visit ? &rand;
%put &=oink;
%put &=oink2;

proc sql;
    select name,(&oink2) from sashelp.class;
quit;
%mend;

options mprint;
%test3

 

So, the answer depends on how and where the macro and these macro variables will be used. You didn't really give that information.

--
Paige Miller
TimWright22
Fluorite | Level 6
I did not mention that this is used for date variables. Since all of sources seem to agree, I suppose I should just give the answer as they recommend. It doesn't seem like they can grade it wrong when all of the practice exams have it this way. It just makes me uneasy to provide an answer to the test when I do not understand why that answer is correct. I can afford to miss 30% and pass. hopefully this will not make the difference.
PaigeMiller
Diamond | Level 26

Okay, used for date variables. But where? In a DATA step or PROC IML or PROC SQL, the minus sign can work (if done properly). Most other places, such a thing doesn't work.

--
Paige Miller
Tom
Super User Tom
Super User

@TimWright22 wrote:

I am about to take the certification exam for clinical trials programming. There is one question which I will have to enter, instead of multiple choice, that uses a question mark instead of an "-" for subtraction of mocro variables. For example, inside of a user created macro, the difference between &visit and &rand is listed as &visit ?&rand +1; 

It seems like the answer should be &visit - &rand+1;

 

If it helps, this is within the user defined macro studyday.

 

%macro studyday(rand,visit);

&visit ?&rand;

%mend studyday;

 

For the same test, the answers for the practice examps do not have a " " between words. For example, one answer is RETAINSUBJECTID. I'm not so concerned about these. But if anyone wants to recommend whether I should say "retainsujectid" or "retain subjectid", that would be welcome.  


Not exactly clear what you are asking, but it sounds like someone somewhere converted the hyphen used in SAS to represent subtraction operator into some other character, like an endash or emdash, and the font being used to display the line did not support that character so it was replaced with a question mark.

PaigeMiller
Diamond | Level 26

@Tom wrote:


Not exactly clear what you are asking, but it sounds like someone somewhere converted the hyphen used in SAS to represent subtraction operator into some other character, like an endash or emdash, and the font being used to display the line did not support that character so it was replaced with a question mark.


Very good guess! 

--
Paige Miller
TimWright22
Fluorite | Level 6

Hi Paige Miller. Thanks your your assistance. I see that I did not give you all of the context. This is used in a data step:

 

data vs_sd;

set VS;

label rdt = "rdt label";

label vdt= "vdt label";

VSDT = %studyday(rdt,vdt);

run; 

Tom
Super User Tom
Super User

I think you are asking two unrelated questions here.

 

The first one looks like it is about how to number study days. Should the first day be day zero or day one.  The answer is that either method is fine as long as that is what your analysis plan says to do.  If you want to number from one the use visit date minus baseline date plus one.  If you want to number from zero do not add the plus one.

 

The second question appears to be does the RETAIN statement require a space before the start of the list of variables to be retained.  And the answer is yes.  Otherwise it is not a RETAIN statement.

TimWright22
Fluorite | Level 6

I suppose that what it comes down to is whether we think it is safe to use "?&" instead of "-&" in response to this question if it appears on the certification exam. I have decided that there is no reason to give an answer that is different from the one provided in the study guides, regardless of whether I understand why "?&" is used instead of "- &". It is certainly not worth spending so much time on this question when I actually know the answer, and it may not even be asked. Thanks for your assistance.

And yes, the second question was completely unrelated. In that case, I will go with what makes sense. I am not about to answer a question without a space where there clearly ought to be one.  I am never going to type 'RETAINSUBJECTID' as a response to a test question, so that part was not really worth asking, I consider this issue closed. Thanks

Welcome to the Certification Community

 

This is a knowledge-sharing community for SAS Certified Professionals and anyone who wants to learn more about becoming SAS Certified. Ask questions and get answers fast. Share with others who are interested in certification and who are studying for certifications.To get the most from your community experience, use these getting-started resources:

Community Do's and Don'ts
How to add SAS syntax to your post
How to get fast, helpful answers
3 ways to show off your SAS skills

 

Why Get SAS Certified.jpg

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 980 views
  • 0 likes
  • 3 in conversation