06-24-2015 01:59 PM
I wish to know what is the procedure and the transformation to be used to get rid of the last record. Suppose, there is a dummy record in the last observation and I want to get rid of it using a transformation.
Ex: out of 11 recrods, the last is found to be dummy and I want to read only first 10 records..(using transformation and no user written code)Di
06-30-2015 06:11 AM
Assuming we're talking about external data (eg. a text file) and not a table.
First question: What constitutes a dummy record? Let's assume this is a record with no data (just an empty line). So writing SAS code you could code something like:
if missing(_infile_) then return;
input a b c;
You can "force" DI to generate such code by "injecting" it using the External File Metadata Definition under "File Parameter / Advanced"
This will generate the "infile" statement as follows:
So basically above approach allows you to "inject" any code between the generated INFILE and INPUT statement.
Does this solve your problem?
07-12-2015 06:05 PM
This did help and yes the file is a .txt. However, dummy means that it has data but cannot be processed further, the entire records needs to be dropped.
After I read the file successfully using the file reader, I make use of slitter to hard code the value present in the variable in row selection
I wish to know is there a workaround to strip first and last records. Just like first.variable and last.variable in datastep. The variable here is Mortgage... and if I wish to strip the first header record - I make use of _N_ ~= 1, similarly, I wish to know how to strip the last record of the file rather than hard coding to value or like operator.
07-13-2015 03:53 AM