DATA Step, Macro, Functions and more

Help me with the bug in the field

Reply
New Contributor
Posts: 3

Help me with the bug in the field

The attached file contains one column and 25 rows. The length of the string in the column is 16, but the format is given as $30.

When I try to export the dataset into .csv or any other format, the strings get broken into two parts and make 50 rows.

Can some please help me exporting the string intact ?

My Contact number is +91 - 9711913925

Skype id is rajat.musigma

email - rajatagarwalismd@gmail.com

Attachment
Trusted Advisor
Posts: 2,113

Re: Help me with the bug in the field

You appear to have an embedded linefeed ( ''0A'x ) in each string.  That is why it is displaying as two line on the export ('0A'x is the end-of-line character in Unix and many PC programs also interpret it that way.

303038363538313332300A3130323930


If the hex output for your first line of data (note the '0A').


Doc Muhlbaier

Duke

New Contributor
Posts: 3

Re: Help me with the bug in the field

Dear Sir,

Thanks a lot for the insight. I was expecting something like an "Enter key" embedded within the string. It very much explains the issue.

Could you please suggest me a way to remove this ( ''0A'x ) from the string, as I need to extract data in the intact form ?

Also, could you please help me how to get the hexadecimal of the string/number in SAS.

Thanks a lot,

Rajat

Trusted Advisor
Posts: 2,113

Re: Help me with the bug in the field

Rajat,

To display the hex representation of a character string, I simply applied the $hex format to it.  You can read about that in the documentaiton.

To remove the control characters from a string, use the COMPRESS function.  See

http://www2.sas.com/proceedings/sugi31/028-31.pdf

or the documentation for exact syntax.

Doc

Ask a Question
Discussion stats
  • 3 replies
  • 211 views
  • 4 likes
  • 2 in conversation