BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Kiko
Fluorite | Level 6

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!

 

 



1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

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
;

View solution in original post

2 REPLIES 2
BrunoMueller
SAS Super FREQ

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
;
WarrenKuhfeld
Ammonite | Level 13

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
      

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 2 replies
  • 1036 views
  • 0 likes
  • 3 in conversation