0
votes

I'm using infile on the following data

data hw10;

infile '\Client\C:\Users\drhunt\Desktop\datahw10.dat' DSD dlm='09'X firstobs=2 Missover;

enter code here

ID Age Gender Status Overall Q1 Q2 Q3 Q4
Q5 Q6 1 22 2 Student 3 3 1 3 2 3 2 2 21 2 Student 4 3 2 3 4 3 4 3 18 1 Faculty 3 3 2 2 3 3 4 4 19 2 Faculty 2 1 2 3 2 3 3 5 26 1 Student 4 3 4 3 4 4 3 6 20 1 Student 4 3 2 4 3 3 4 7 29 2 Student 2 2 3 3 2 3 1 8 22 1 Faculty 4 3 2 4 4 4 4 9 19 1 Student 2 2 4 1 3 3 1 10 20 2 Student 2 2 2 3 3 1 3 11 60 2 Faculty 3 3 3 1 2 2 1 12 22 1 Student 1 3 2 2 1 2 1

Naturally as you can see there is a formatting error in it so here's my code

input   ID Age Gender Status Overall Q1 Q2 Q3 Q4 Q5 Q6;

Label Q1 = 'Knowlwedgeable about subject'
      Q2 = 'Prepared and organized'
      Q3 = 'Explain concepts well'
      Q4 = 'Held my attention'
      Q5 = 'Encouraged and receptive to questions'
      Q6 = 'Enthusiastic about teaching';


run;
proc print data=hw10;
run;
*Part B Hw10*;
Proc freq data=hw10 Order=Data;
Tables Gender status Gender*status/Chisq Norow;
run;quit;
*Part C Hw10*;
Proc freq data=hw10 Order=Data;
Tables Gender*status/List Nocum;
run;quit;

My issue is in Part A for some reason the column containing the datalines for Status will not show up in my output. Is there any particular thing that I am doing wrong?

1

1 Answers

0
votes

If you don't specify the variable type on your input statement SAS will assume your input variables are all numeric. Try adding a $ sign after your character variables, eg:

data want;
input ID Age Gender Status $ Overall Q1 Q2 Q3 Q4 Q5 Q6 ;
cards;
1 22 2 Student 3 3 1 3 2 3 2 
2 21 2 Student 4 3 2 3 4 3 4 
3 18 1 Faculty 3 3 2 2 3 3 4 
4 19 2 Faculty 2 1 2 3 2 3 3 
5 26 1 Student 4 3 4 3 4 4 3 
6 20 1 Student 4 3 2 4 3 3 4 
7 29 2 Student 2 2 3 3 2 3 1 
8 22 1 Faculty 4 3 2 4 4 4 4 
9 19 1 Student 2 2 4 1 3 3 1 
10 20 2 Student 2 2 2 3 3 1 3 
11 60 2 Faculty 3 3 3 1 2 2 1 
12 22 1 Student 1 3 2 2 1 2 1
;
run;

This will store status as a character with a default length of 8. The rest are imported as numeric.