BookmarkSubscribeRSS Feed
Shuhan_Chen
Calcite | Level 5

I need to read specific lines from the external dataset and write them into a new dataset, arranged according to the specified variables. But it always shows "Note: Lost Card", resulting in an empty dataset being read.

 

The log also shows a prompt of "Note: Data file MOID. DIED17. DATA is in a format that is native to another host, or the file encoding does not match the session encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce performance". After adding "MISSOVER" or "TRUNCOVER", the log also shows the above content but does not show the "Note: Lost Card".

 

May I ask what the reason is? How to solve it? Thanks for your help!

 

The specific logs are as follows:

Q_00.png

Libname MOID "D:\Data1";
data MOID.DIED17; infile 'D:\A_Personal_Data\Cdata' lrecl=1743 recfm=d truncover;
Input  ;
IF REST < 4 AND DOB = 2016; 
PROC SORT; BY SEQNUM; 
RUN;

 

2 REPLIES 2
Kurt_Bremser
Super User

Your code as posted cannot work, as the empty INPUT statement will not populate any variables, and all values in the IF condition will be missing.

Please post your real code, so we can see how you try to read from the infile; a message like yours is usually caused by having too many variables in the INPUT and no option in place for how to deal with shorter infile lines.

Also open the file with a text editor and copy/paste a few lines into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

Also use this sub-window for logs; logs in text form can be annotated by people trying to help you.

 

Patrick
Opal | Level 21

The first note is "weird" given that the code you share is not reading an existing SAS table but creating a new one.

Patrick_0-1707638639337.png

 

But given the other syntax errors I'd assume this note will "go away" once the rest is fixed.

Patrick_1-1707638745847.png

1. End a data step with a RUN; statement. 

2. Your infile statement indicates you are trying to read a text file called Cdata into a SAS table. To do so you also need to instruct SAS how to read the text data into variables - that's done in the INPUT statement.

3. You will likely also need to define what character separates data in your source text file. That's done via infile option dlm='<delimiting character>'

 

Your condition "if rest < ..." can only work after you've created and populated this variable as part of the INPUT statement.

 

What you're trying to do looks "basic". I suggest you revisit your training material and/or consult SAS docu like Reading External Files

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 2 replies
  • 414 views
  • 0 likes
  • 3 in conversation