BookmarkSubscribeRSS Feed
RajasekharReddy
Fluorite | Level 6

Hello ,

 

I am using PUT & INPUT function so long and using below like

 

xx=put(aa,?best.)

zz=input(bb,??best.)

 

May i know why we are using "?" in put & input function and what is difference with out "?" and with "?"

 

Thank you in advance.

 

 

3 REPLIES 3
PeterClemmensen
Tourmaline | Level 20

The INPUT Function Documentation says:

 

? or ??

specifies the optional question mark (?) and double question mark (??) modifiers that suppress the printing of notes and input lines when invalid data values are read. The ? modifier suppresses the invalid data message. The ?? modifier suppresses the invalid data message and prevents the automatic variable _ERROR_ from being set to 1 when invalid data is read.

ballardw
Super User

An example use case: Data being read has a date field in mm/dd/yyyy format but missing values where the data was not recorded are represented by 99/99/9999.

Since you know that values will be invalid dates and actually represent missing data when the values are read you will be okay with SAS variables with missing values but you may not want to wade through a bunch of junk in the log for a know data issue. So a data step to read the example data uses the ?? modifier as follows:

 

data example;
   input x ??mmddyy10.;
   format x mmddyy10.;
datalines;
01/01/2019
99/99/9999
;
run;

remove the ?? and replace with either a single ? or nothing to see the different behaviors.

 

Reading a field that should be numeric but sometimes has NA or other not entered or not available code would be another similar use.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 741 views
  • 0 likes
  • 4 in conversation