Hello
I am trying to read data from a text file. When I did that using the statement below I got notes saying 'invalid data for xyz variable'; I went back to the txt file and they had missing values. Is there any way I can tell SAS to ignore the observations w/ missing values or just get a summary of how many of those have missing values instead of getting notes for each case? The two variables I had missing values are: DTFSPNTC and DLNRMNBG
data selected;
infile bb missover;
input @1 caseid 6.
@172 dob mmddyy8.
@414 age 2.
@1567 DTFSPNTC mmddyy8.
@1672 DLNRMNBG mmddyy8.
@1749 weight 4.
@1759 multiple 1.;
format dob date9.
DTFSPNTC date9.
DLNRMNBG date9.;
run;
Thank you!
You can use the ?? modifier to suppress the note on the invalid data, see sample below
data want;
infile cards;
input
@1 someDate ?? mmddyy8.
@10 someDate2 mmddyy8.
@19 someChar $3.
;
format someDate: date9.;
cards;
09112017 11092017 abc
11102017 def
22112017 11112017 ghi
;
You can use the ?? modifier to suppress the note on the invalid data, see sample below
data want;
infile cards;
input
@1 someDate ?? mmddyy8.
@10 someDate2 mmddyy8.
@19 someChar $3.
;
format someDate: date9.;
cards;
09112017 11092017 abc
11102017 def
22112017 11112017 ghi
;
SAS does not print a note when it encounters missing values in an input data set. You must have something else going on like character strings where SAS is expecting numeric values.
data x; input x; datalines;
.
;
proc print; run;
9 +data x; input x; datalines;
11 +;
NOTE: The data set WORK.X has 1 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.