0
votes

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?

1
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. - sasfrog
@sasfrog Want to make that an answer so I can upvote it? - BellevueBob
At time of viewing this is the 999th question tagged with the SAS tag. Pretend this comment is animated with a lairy border inviting you to click to win an iPad. - sasfrog

1 Answers

2
votes

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.