07-20-2015 02:37 PM
Hey SAS Folks,
I would like to suppress the error message and invalid note in the log when reading a variable using the ?? modifier in the input statement. However, what if i want to use the same for many variables? Is there an easier or short cut that I can choose to use such a modifier for as many variables as i want in one shot?
A typical example would be when reading a date variable with a specific informat.
Many thanks for your help if you can.
07-20-2015 03:16 PM
Although it may be possible to do a CodeGen manipulating text to add ?? to every single one of your numeric informat, here is trick if you have EG. Using EG to import text file (or even excel file) will generate SAS code with ??informat as default. I have been using EG to import files ever since the first time.
07-20-2015 03:26 PM
It would help to see the input statement you have now.
Here is example that uses list input with default INFORMATS and those specified for DATE variables.
07-21-2015 09:52 AM
Try this one :
informat a b c date9.;
format a b c date9.;
input a x b s y c;
x y z a b 21JUL2015
x y 20JUL2015 a b 19JUN2015
x y z a b 20JUN2015
54 data test;
55 informat a b c date9.;
56 format a b c date9.;
57 input a x b s y c;
NOTE: Invalid data for a in line 60 1-1.
NOTE: Invalid data for x in line 60 3-3.
NOTE: Invalid data for b in line 60 5-5.
NOTE: Invalid data for s in line 60 7-7.
NOTE: Invalid data for y in line 60 9-9.
NOTE: Invalid data for a in line 61 1-1.
NOTE: Invalid data for x in line 61 3-3.
NOTE: Invalid data for s in line 61 15-15.
NOTE: Invalid data for y in line 61 17-17.
NOTE: Invalid data for a in line 62 1-1.
NOTE: Invalid data for x in line 62 3-3.
NOTE: Invalid data for b in line 62 5-5.
NOTE: Invalid data for s in line 62 7-7.
NOTE: Invalid data for y in line 62 9-9.
NOTE: The data set WORK.TEST has 3 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
07-21-2015 10:34 AM
Close but I think you need option ERRORS=0 to suppress the invalid data messages.
07-21-2015 04:37 PM
Thank you super stars John and Xia Keshan as always for your help. Let me test the same tomorrow at work and acknowledge as it is too late right now in England. I appreciate it so much.