I am a SAS novice. I wrote up code using a "fake" data set so that I could be sure the code worked when I had data. However, I used an infile line to read in the fake data, and PROC IMPORT to read in the real data. Almost everything works the same, except 2 variables I create in the data step (marked in bold)
Here is the original code, where i read in the data from a .txt file, and the 2 variables are created and work fine.
data PatientEval;
filename data 'U:\Patient Eval Study\Fake Patient Eval Data Errors.txt';
infile data DLM = '09'X DSD;
input ID Resident_ID Program Year
Question_1 Question_2 Question_3 Question_4 Question_5 Question_6
Question_7 Question_8 Question_9 Question_10 Question_11 AIDET_1
AIDET_2 AIDET_3 AIDET_4 AIDET_5
;
pYear = Program*10 + Year; /*Creates a variable that reads both Program and Year*/
noCount = 0; /* Counts how many "no" answers for AIDET Questions are given*/
if AIDET_1 = 0 then noCount = noCount+1;
if AIDET_2 = 0 then noCount = noCount+1;
if AIDET_3 = 0 then noCount = noCount+1;
if AIDET_4 = 0 then noCount = noCount+1;
if AIDET_5 = 0 then noCount = noCount+1;
label Resident_ID = 'Resident ID'
Program = 'Program'
Year = 'Year'
Question_1 = 'Greeting'
Question_2 = 'Listens'
Question_3 = 'Interested'
Question_4 = 'Respectful'
Question_5 = 'Explicit'
Question_6 = 'Educate'
Question_7 = 'Comprehensible'
Question_8 = 'Collaborative'
Question_9 = 'Engaged'
Question_10 = 'Straightforward'
Question_11 = 'Diplomatic'
pYear = 'Program and Year'
AIDET_1 = 'Acknowledge'
AIDET_2 = 'Introduce'
AIDET_3 = 'Duration'
AIDET_4 = 'Explain'
AIDET_5 = 'Thank'
noCount = 'Number of Failed AIDET Questions';
;
Here is the new code, with the IMPORT procedure. The 2 variables aren't created here.
PROC IMPORT OUT= WORK.PatientEval
DATATABLE= "Data Code"
DBMS=ACCESS REPLACE;
DATABASE="N:\ACGME Competencies\360\Fall 2008 Patient Evaluation\Fall 2008 Patient Evaluation Database.mdb";
SCANMEMO=YES;
USEDATE=NO;
SCANTIME=YES;
RUN;
data PatientEval
input ID Resident_ID Program Year
Question_1 Question_2 Question_3 Question_4 Question_5 Question_6
Question_7 Question_8 Question_9 Question_10 Question_11 AIDET_1
AIDET_2 AIDET_3 AIDET_4 AIDET_5
;
pYear = Program*10 + Year; /*Creates a variable that reads both Program and Year*/
noCount = 0; /* Counts how many "no" answers for AIDET Questions are given*/
if AIDET_1 = 0 then noCount = noCount+1;
if AIDET_2 = 0 then noCount = noCount+1;
if AIDET_3 = 0 then noCount = noCount+1;
if AIDET_4 = 0 then noCount = noCount+1;
if AIDET_5 = 0 then noCount = noCount+1;
label Resident_ID = 'Resident ID'
Program = 'Program'
Year = 'Year'
Question_1 = 'Greeting'
Question_2 = 'Listens'
Question_3 = 'Interested'
Question_4 = 'Respectful'
Question_5 = 'Explicit'
Question_6 = 'Educate'
Question_7 = 'Comprehensible'
Question_8 = 'Collaborative'
Question_9 = 'Engaged'
Question_10 = 'Straightforward'
Question_11 = 'Diplomatic'
pYear = 'Program and Year'
AIDET_1 = 'Acknowledge'
AIDET_2 = 'Introduce'
AIDET_3 = 'Duration'
AIDET_4 = 'Explain'
AIDET_5 = 'Thank'
noCount = 'Number of Failed AIDET Questions';
;
The log error is:
ERROR: NO DATALINES OR INFILE STATEMENT.
How do I get the variables to work in the 2nd instance?
Thanks,
Ashley Adams
SEAHEC