« Where statements in the DATA step | Main | Create random number string in SAS »

January 07, 2013

Importing files in SAS

This will import a comma delimited file. Note that input is required and can be used to specify only certain variables that should be part of the dataset.


DATA work.test3;
infile 'J:\blaise_sample_files\mixed_mode\5_sample_set\sample_other.csv' dlm=',';
input var1 var2;
run;

This SAS pdf has more.

There is also a PROC IMPORT statement but I'm not sure when you would use one approach over the other.

PROC IMPORT OUT=work.test
			FILE = "J:\blaise_sample_files\mixed_mode\5_sample_set\sample_other.csv"
			DBMS = CSV REPLACE;
	GETNAMES = YES;
	DATAROW = 2;
RUN;

Posted by kkwaiser at January 7, 2013 12:55 PM

Comments

Login to leave a comment. Create a new account.