BookmarkSubscribeRSS Feed
Defense
Obsidian | Level 7

I try to infile a sas file (CRF.sas) to sas using the following code. The output dataset is “Want”.

              data want;

 

infile "C:\Users\weig3\Desktop\CRF.sas" ;

input col $ 1-300;

 

RUN;

 

 The CRF.sas contain 6 line as below

 The “want” contains only 4 line as below

 

It sounds the line “data data1 (label=”Demographics”);” is missing( Please see attached file for details.)

 

Could anyone help me to avoid the error?

 

Thanks

6 REPLIES 6
Reeza
Super User

If you want us to test it, you should upload the text file. To test it, I'd have to type it out and I don't do that on principle 🙂

 

Try changing LRECL on the infile statement and include the TRUNCOVER option.

infile "C:\Users\weig3\Desktop\CRF.sas" lrecl=300 truncover ;
Defense
Obsidian | Level 7

Thanks.

Attached is CRF.sas file

Defense
Obsidian | Level 7

Thanks.

Attached is CRF.sas file

Defense
Obsidian | Level 7

NOTE: 0 records were read from the infile "C:\Users\weig3\Desktop\CRF.sas".

NOTE: The data set WORK.WANT has 1 observations and 0 variables.

NOTE: DATA statement used (Total process time):

real time 0.03 seconds

cpu time 0.01 seconds

 

Reeza
Super User

My initial answer was correct in my tests. 

 

 

Defense
Obsidian | Level 7

Thanks.

I did not add "input col $1-300;"

complete code is

 

data want;

infile "C:\Users\weig3\Desktop\CRF.sas" lrecl=300 truncover;

input col $1-300;

RUN;

 

 

Works. Thanks

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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