0
votes

I have the following task

sample

i tried dlm='",'

but it will seperate the 3rd line of the data into 5 part

i have also tried scan(name,1,'"') but the 3rd lines will also occur problem, which only out put Smith

1
Look at the DSD option for your infile statement.Reeza

1 Answers

2
votes
DATA MYDATA;
    LENGTH NAME $15.;
    INFILE DATALINES DSD;
    INPUT NAME $ AGE WEIGHT HEIGHT;
    DATALINES;
BRADLEY, 35, 68, 155
"BILL JOHNSON", , 70, 200
"SMITH, JEFF", 27, 70, 188
;

works for me!

Your delimiter option would have failed because of the comma in Jeff Smith's name. It's not really appropriate to try to use string functions at the infile stage - problems can usually be sorted out easily enough once the raw data has been read in.