I have a long and complicated dataset in a .txt file where I can get it to read the dataset and get most of the data in the correct positions in the output. However there is one character variable that sometimes is missing in the .txt file and rather than having no value for that variable in the output, the next variable is just shifted into the missing variable's slot screwing up the remaining data. How do I prevent that from happening while only using where statements in the data step? (var5 is my problem variable and using SAS OnDemand)
Example code:
data dataset;
infile example.txt dlm='09'x;
input number var1 $ var2 var3 $ var4 $ var5 $ var6 $ var7 $ var8 $ var9 $ var10 $ @;
drop number;
run;
From example.txt file
1 xxx 1234 xxx xxx xxx xxx xxx xxx xxx
2 xxx 1234 xxx xxx xxx xxx xxx xxx xxx
3 xxx 1234 xxx xxx xxx xxx xxx xxx xxx xxx
4 xxx 1234 xxx xxx xxx xxx xxx xxx xxx xxx
5 xxx 1234 xxx xxx xxx xxx xxx xxx xxx
6 xxx 1234 xxx xxx xxx xxx xxx xxx xxx
Example output
var1 var2 var3 var4 var5 var6 var7 var8 var9 var10
xxx 1234 xxx xxx xxx xxx xxx xxx xxx 2
xxx 1234 xxx xxx xxx xxx xxx xxx xxx xxx
xxx 1234 xxx xxx xxx xxx xxx xxx xxx xxx
xxx 1234 xxx xxx xxx xxx xxx xxx xxx 6