BookmarkSubscribeRSS Feed
LineMoon
Lapis Lazuli | Level 10

Hello experts,

Please, I need a solution for the back on-line in text file used by sas under unix.

 

Exemple

 

toto.txt(incorrect)

ID   name         comments

1     Cook          treatement

ùR10 Beta45 

 

The correct file  will be

ID   name         comments

1     Cook          treatement R10 Beta45 

 

Please, any solution in unix or sas or both ?

 

 the unix command cat -v gives this

1     Cook          treatementM^ùR10 Beta45

and the unix command "dos2unix does" not work for me.

 

Thank you

 

 

 

 

 

 

3 REPLIES 3
Community_Guide
SAS Moderator

Hello @LineMoon,


Your question requires more details before experts can help. Can you revise your question to include more information? 

 

Review this checklist:

  • Specify a meaningful subject line for your topic.  Avoid generic subjects like "need help," "SAS query," or "urgent."
  • When appropriate, provide sample data in text or DATA step format.  See this article for one method you can use.
  • If you're encountering an error in SAS, include the SAS log or a screenshot of the error condition. Use the Photos button to include the image in your message.
    use_buttons.png
  • It also helps to include an example (table or picture) of the result that you're trying to achieve.

To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message.  From there you can adjust the title and add more details to the body of the message.  Or, simply reply to this message with any additional information you can supply.

 

edit_post.png

SAS experts are eager to help -- help them by providing as much detail as you can.

 

This prewritten response was triggered for you by fellow SAS Support Communities member @Reeza

.
ballardw
Super User

Is this related to reading in a text file? If so show the code you attempted and example lines from the text file. Post code and example data in code box opened using the {I} icon. In a text file use of the code box is critical to retain plain text formatting. Otherwise lines shown could be quite different than the source.

 

The original source of the data may also be an issue as we should know whether your system is Unix or the source file originated on a Unix platform. If your system is Unix and the file is from a Mac or Windows system you may need to tell your program which line terminator to use when reading the file as the different operating systems use different ways to indicate the end of a line. The SAS INFILE option TERMSTR often helps.

LineMoon
Lapis Lazuli | Level 10

@ballardw: Thank you very much.

 Yes, it is  related to reading a text file.

As you know, it is indpendant of code, it is really a data problem

 

I must have this data input

ID   name         comments

1     Cook          treatement R10 Beta45

 

With this matter, I will have

ID   name         comments

1     Cook          treatement

ùR10 Beta45

 

I think some unix commands can resolve the problem( my sas is under unix)

 

 

 

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