If the input for both output datasets is the same file,
you can create both outputs within the same data step
but assigning different KEEP variables for each of them.
The code should like to:
data origfileQ12018 (keep= <list of variables to keep here>)
svcgfileQ12018 (keep= <list of variables to keep here>);
length <define max length of character variables> ;
infile "C:\Real_estate\sample_2018.txt" dlm= '|'
MISSOVER DSD lrecl=32767 firstobs=1 ;
input
/***
enter ALL input variables with their var-type ('$' or none )
in the right order without informat length
***/
;
run;
Both of those INFILE statements are pointing to the same file but the Input statements are different.
I suggest that your "missing" data is coming from reading the wrong file and getting variable type mismatches.
What did your LOG look like for the origfileQ12018 datastep? I bet it has a lot of "invalid data" messages.
Thanks for your response.
@benlee wrote:
Ballardw:Thanks for your response.
The LOG keeps saying the following:
NOTE: Invalid data for fico in line 20 1-12.
WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed
How can I modify the code?
Thanks,
Error related posts should include the entire data step code plus all the errors.
Did you pay any attention to the fact that your shown code is attempting to read the same file with different input statements?
Input statements when they are just lists of variables as yours are read columns in order.
So
nfile "C:\Real_estate\sample_2018.txt" dlm= '|' MISSOVER DSD lrecl=32767 firstobs=1 ; input fico : 8.
attempts to read the first column in the data set as a number (the 8. informat).
The values are :
F118Q3000001|201809|150000|0|0|360|||||4.75|0||||||||||||||||
So you are attempting to read F118A3000001 as a number.
Not going to happen.
If the website gave you that code then it is intended to read a different file layout. One where the first value is actually numeric.
If the input for both output datasets is the same file,
you can create both outputs within the same data step
but assigning different KEEP variables for each of them.
The code should like to:
data origfileQ12018 (keep= <list of variables to keep here>)
svcgfileQ12018 (keep= <list of variables to keep here>);
length <define max length of character variables> ;
infile "C:\Real_estate\sample_2018.txt" dlm= '|'
MISSOVER DSD lrecl=32767 firstobs=1 ;
input
/***
enter ALL input variables with their var-type ('$' or none )
in the right order without informat length
***/
;
run;
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.