* Create SAS data set from hair data; * Read data file 'hair_data.txt'; DATA hair; INFILE 'z:\My Documents\teaching\stat_517\hair_data.txt'; INPUT color $ pain; RUN; PROC PRINT DATA = hair; RUN; * When the external file location is a web page; * Can use FILENAME statement; DATA hair; FILENAME webpage URL 'http://people.stat.sc.edu/hitchcock/hair_data.txt'; INFILE webpage; INPUT color $ pain; RUN; PROC PRINT DATA = hair; RUN; /**********************************************************************************************/ /** Reading data using the INFILE CARDS type of statement **/ /* This is useful for those of you using the SAS OnDemand Enterprise Guide or SAS Studio */ DATA hair; INFILE CARDS; INPUT color $ pain; CARDS; LtBlond 62 LtBlond 60 LtBlond 71 LtBlond 55 LtBlond 48 DkBlond 57 DkBlond 63 DkBlond 52 DkBlond 41 DkBlond 43 LtBrunet 42 LtBrunet 50 LtBrunet 41 LtBrunet 37 DkBrunet 32 DkBrunet 39 DkBrunet 51 DkBrunet 30 DkBrunet 35 ; RUN; /* The above data set is copied exactly from the hair_data text file on the course web page */ PROC PRINT DATA = hair; RUN;