BookmarkSubscribeRSS Feed
balinsk1
Calcite | Level 5

Hello, 

 

I keep getting error messages and have not been able to figure out how to adjust my data to make this work. Any help would be greatly appreciated. Thanks!

9 REPLIES 9
balinsk1
Calcite | Level 5

I tried both of these things and was still not able to get it to work. Also the GROC variable is meant to be numeric so I don't want it to be read as a character variable. Any other thoughts?

Kurt_Bremser
Super User

@balinsk1 wrote:

I tried both of these things and was still not able to get it to work. Also the GROC variable is meant to be numeric so I don't want it to be read as a character variable. Any other thoughts?


Look at your log. "T04" is positively not numeric.

 

Edit: it seems to be what @Tom already found. You have line breaks in character columns.

balinsk1
Calcite | Level 5
So the T04 is actually input for the therapist ID variable and not for GROC. The therapist ID variable is meant to be a character variable but the GROC variable is meant to be numeric.


Tom
Super User Tom
Super User

Why did you go to the trouble of making a PDF file and adding as an attachment instead of just copying the text and pasting it into your question.

For example here are the notes from the end of the data step about how many lines read:

 NOTE: 203 records were read from the infile REFFILE.
 The minimum record length was 50.
 The maximum record length was 321.
 NOTE: The data set WORK.IMPORT5 has 203 observations and 59 variables.

There is no way you could have a line with only 50 characters that contains values for 59 variables.

Most likely some of the lines have embedded end of line character in them and that is confusing the data step.

Remove those end of line characters.

Since the file only has 203 lines (and will have less once you fix it) just open it in a TEXT editor and remove those offending end of lines.

balinsk1
Calcite | Level 5
Hi,
I am not sure how to remove embedded end of line characters. What is the best way to do this?
Tom
Super User Tom
Super User

@Kurt_Bremser wrote:

See here: https://support.sas.com/kb/26/065.html 


If you use that code make sure to run it on a COPY of the file as it modifies the file you run it against.

They even include a warning on the Knowledge Base page.

 

You should make a copy of your file before running this sample on it.

Tom
Super User Tom
Super User

@balinsk1 wrote:
Hi,
I am not sure how to remove embedded end of line characters. What is the best way to do this?

You don't know how to edit a text file? How did you create the SAS program code then?

You should have some type text editor on your computer. Such as NOTEPAD program that comes with WIndows.  Just open the file in the editor. find the lines where the line breaks are. It should be obvious. In your posted log the second part all started with a quote. Just delete the end of line before the quote on those broken lines.

 

If you want to use CODE to fix the file here is a link to a macro that will attempt to fix it.  But it will only work on files that are corrupted in a well defined pattern. That is they have extra end of line characters enclosed in double quote characters.

https://github.com/sasutils/macros/blob/master/replace_crlf.sas

 

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
  • 9 replies
  • 583 views
  • 1 like
  • 3 in conversation