BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION

Accepted Solutions
Shmuel
Garnet | Level 18

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;

View solution in original post

4 REPLIES 4
ballardw
Super User

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.

benlee
Calcite | Level 5
Ballardw:

Thanks for your response.

 

ballardw
Super User

@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.

Shmuel
Garnet | Level 18

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;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 682 views
  • 0 likes
  • 3 in conversation