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

Sage Stats and CQ Political Stats Trial

Breaking News: Protect the 2020 Census

The Fastest Growing US Cities Are Mostly In the West

Another rule from NIH: Demographers might get to ignore this one

Research on Health Disparities: Incarceration Matters

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: