Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Expansion of Free Lunch Could Have a Negative Effect on Research Data

You’ll live longer than you think you will [HRS data]

Federal Register Notice: Some ACS questions on the chopping block

Political Science: A self-inflicted wound?

Sage Stats and CQ Political Stats Trial

Data Services Knowledge Base

Q:  

I am having trouble reading a file into SAS. SAS is complaining about the last variable in each record. If I look at it with an editor, it looks like a ^M.

A:  

You are using a file created in a DOS/Windows environment on unix. Unix files end in a line feed and files created in DOS end in a carriage return/line feed. There are several ways to get rid of this extra character:

Your unix operating system may have several utilities on it that take care of this, dos2unix and unix2dos.

Assume that the file created in the DOS/Windows environment is called file_w and the file you want to create for analysis using unix will be called file_u.

dos2unix file_w file_u

unix2dos does the opposite. It takes a file created in unix and adds a carriage return/line feed:

unix2dos file_u file_w

If your system does not have these utilities, the following command in unix is the equivalent of dos2unix:

tr -d '\015' < file_w >  file_u

Related Question Groups: