Danai C.
Danai C.

Reputation: 135

Read txt file in sas

I have a very simple question. I'm trying to read a txt file in sas. The data set, has 6 variables (columns) one of these variables is qualitative, with elements M and F. I use the following code to read the data:

data dta;
    infile 'C:\...\dta.txt';
    input ID $ Q y1 y2 y3 y4; 
    run;

When I print the data set, I get dots in the column of the qualitative variable (Q), instead of F and M.

What I'm doing wrong. Could you help me?

Upvotes: 0

Views: 422

Answers (1)

sasfrog
sasfrog

Reputation: 2460

Try putting a dollar $ sign after Q in your input statement, so it reads:

input ID $ Q $ y1 y2 y3 y4;

SAS assumes an incoming variable is numeric unless explicitly told otherwise, which is what the $ does on an input statement.

Upvotes: 2

Related Questions