/*Playing around with reading data in from the web into SAS. Ted Walls. Sept 24, 2008. For Graduate Lab Course*/ /*first try--bringin in the data directly and using fancy data step*/ filename sol url 'http://www.uri.edu/faculty/walls/solomon1.csv'; /*user='Ted' /*prompt proxy='http://inetgw.unx.sas.com:80'*/ run; DATA solomon; INFILE sol; input ID warmcold convers generous happy goodnat humor sociable popular; RUN; proc contents data = solomon; run; proc print data = solomon; run; data sol1; infile sol length=len; input record $varying200. len; put record $varying200. len; firstobs = 2; /*had to add this to stop sas from reading in varnames*/ *if _n_=15 then stop; /*note: this data set will dump the data into the log file, but proc print shows it is improper in the data file;*/ run; proc print data = sol1; run; /*second try--reading in as comma delimited with input of real col names*/ filename sol url 'http://www.uri.edu/faculty/walls/solomon1.csv' /*user='Ted' /*prompt proxy='http://inetgw.unx.sas.com:80'*/; data temp1; infile sol dlm=','; input ID warmcold convers generous happy goodnat humor sociable popular; firstobs = 2; run; proc contents data = temp1; run; data x; set temp1; if convers ne .; run; proc print data = temp1 ; var convers; run; /*Third try--using what appeared in the log file in attempt 1 above*/ data made_from_log_file; infile datalines delimiter=','; input ID warmcold convers generous happy goodnat humor sociable popular; datalines; 8,0,3,5,4,5,6,5,5 9,0,2,4,4,4,5,5,5 10,0,2,5,6,5,5,3,3 11,0,3,5,3,2,2,4,3 12,0,3,3,3,2,5,4,4 13,0,3,4,4,5,5,5,5 14,0,2,6,5,4,6,6,6 15,0,2,4,5,5,5,5,5 17,0,3,3,3,1,3,5,5 18,0,4,3,3,3,2,3,4 21,0,3,4,4,3,5,6,4 23,0,4,4,3,4,4,3,4 24,0,2,3,6,5,5,5,4 27,0,4,3,3,5,4,4,4 28,0,2,1,2,2,5,4,3 31,0,3,4,4,4,4,3,3 34,0,4,3,5,5,3,6,6 35,0,4,3,5,5,3,6,6 36,0,4,3,5,2,2,2,4 38,0,4,5,3,3,3,4,4 1,1,4,2,3,3,5,4,4 2,1,4,2,2,2,3,1,1 3,1,4,3,1,1,3,2,3 4,1,1,2,4,4,6,5,4 5,1,5,3,3,2,4,2,3 6,1,2,4,4,3,4,3,3 7,1,2,3,2,3,4,4,5 19,1,3,1,2,2,2,2,1 20,1,6,2,2,2,4,3,2 22,1,4,1,2,2,3,1,1 25,1,2,2,1,1,4,1,2 26,1,5,2,2,2,4,2,2 29,1,4,3,2,1,3,2,2 30,1,4,4,4,2,1,2,1 32,1,4,1,3,2,3,2,3 33,1,4,2,3,2,3,2,3 37,1,4,2,2,2,3,3,3 run; proc print data = made_from_log_file; run; proc univariate data = made_from_log_file; var convers; run;