in the below prog,how can i enforce SAS to read the second line/record containing the missing data for A2,A4?which option is best to use(missover/truncover/flowover/deleteover)
data temp;
input A1 A2 A3 $ A4 mmddyy10. a5 percent6.;
cards;
1 3 retd 12/12/2009 56.32%
2 tujb 54.32%
;
run;
proc print data=temp;
run; i
What is the attribute of record 2 that tells you that A2 and A4 are missing?
If you will only be missing columns 2,4 and/or 5 the following might work:
data temp (drop=x dummy);
infile cards truncover;
informat a1 a2 12.;
informat a3 $8.;
informat a4 mmddyy10.;
format a4 mmddyy10.;
informat a5 percent6.;
x=0;
input a1 a2 @;
if missing(a2) then do;
input @1 dummy a3 a4 @;
x+1;
end;
else do;
input a3 a4 @;
end;
if missing(a4) then x+1;
if x gt 0 then do;
input @1 dummy @;
do _n_=2 to x;
input dummy @;
end;
end;
input a5;
cards;
1 3 retd 12/12/2009 56.32%
2 tujb 54.32%
;
Before the input statement use
INFILE CARDS TRUNCOVER ;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.