DATA Step, Macro, Functions and more

need help to input sas code as a source file to SAS

Reply
Contributor
Posts: 22

need help to input sas code as a source file to SAS

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

Super User
Posts: 19,860

Re: need help to input sas code as a source file to SAS

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 Smiley Happy

 

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

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

Re: need help to input sas code as a source file to SAS

Thanks.

Attached is CRF.sas file

Attachment
Contributor
Posts: 22

Re: need help to input sas code as a source file to SAS

Thanks.

Attached is CRF.sas file

Attachment
Attachment
Contributor
Posts: 22

Re: need help to input sas code as a source file to SAS

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

 

Super User
Posts: 19,860

Re: need help to input sas code as a source file to SAS

My initial answer was correct in my tests. 

 

 

Contributor
Posts: 22

Re: need help to input sas code as a source file to SAS

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

 

 

Ask a Question
Discussion stats
  • 6 replies
  • 147 views
  • 0 likes
  • 2 in conversation