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

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

Common questions and answers.

Entire collection of data resources.

Latest Data News

RSS Feed icon

Using Stata Effectively

Changing Causes of Death in Poor Countries

Data USA

Are secondary data users research parasites?

Demographic and Economic Profiles of the Super Tuesday States

Data Services Knowledge Base


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.


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: