DATA Step, Macro, Functions and more

Newbie format question ??BEST.

Accepted Solution Solved
Reply
Contributor
Posts: 35
Accepted Solution

Newbie format question ??BEST.

Hi all,

I saw many program that have format ??format.  Used in input, put, ....   I can not find any reference of why they use '??'.  Could anyone explain me a little bit or give me some references to read.

Thank you very much,

Abdu


Accepted Solutions
Solution
‎06-10-2014 05:11 PM
Trusted Advisor
Posts: 1,204

Re: Newbie format question ??BEST.

*(??) modifiers that suppress the printing of both the error messages and the input lines when invalid data values are read.

data have;
input EmployeeID $;
datalines;
12
12
ab
9
13
;
/* With error message */

data want;
set have;
eid=input(EmployeeID, 2.);
run;

/* Without error message */

data want;
set have;
eid=input(EmployeeID, ??best.);
run;

View solution in original post


All Replies
Solution
‎06-10-2014 05:11 PM
Trusted Advisor
Posts: 1,204

Re: Newbie format question ??BEST.

*(??) modifiers that suppress the printing of both the error messages and the input lines when invalid data values are read.

data have;
input EmployeeID $;
datalines;
12
12
ab
9
13
;
/* With error message */

data want;
set have;
eid=input(EmployeeID, 2.);
run;

/* Without error message */

data want;
set have;
eid=input(EmployeeID, ??best.);
run;

Contributor
Posts: 35

Re: Newbie format question ??BEST.

But in this way, we will lost some data issue information.  That is really not a good way to use this modifier.  Any good reason to use this modifier?

Respected Advisor
Posts: 3,124

Re: Newbie format question ??BEST.

if the format does not match the data elements you are reading, you are losing them anyway, unless you change the format to some universal char. ?? is merely to suppress the error message in the log.

Haikuo

Contributor
Posts: 35

Re: Newbie format question ??BEST.

But in Clinical field, we need to catch these information.  This might be a typo, or program flaw, we absolutely need to fix that, not just suppress the error message.  You are right, maybe in the other field, that information is not important.

Respected Advisor
Posts: 3,124

Re: Newbie format question ??BEST.

We are deviating the discussion from the original path that you set. You were asking what "??" do, and I think you have your answer. If you now are trying to ask how to read in certain data intact, then you probably want to show us some sample data, and for the better, to initiate a brand new discussion.  But in general like I mentioned you would need the informats for character instead of number (such as the one you put up for example "best.").

Regards,

Haikuo

SAS Super FREQ
Posts: 685

Re: Newbie format question ??BEST.

Check the doc for the INPUT statement, search for "How Invalid Data Is Handled" it will explain about the ? and ??

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 238 views
  • 0 likes
  • 4 in conversation