/* This program assumes that the caret delimited BHCFYYMM.txt file has been saved to the desktop and that the current SAS directory is the current user directory. You may find it easier to specify the full path rather than the shortcut used here. */ filename bhcfdata ".\Desktop\bhcfYYMM.txt"; /* Replace YYMM with the file you are importing. */ /* This step creates a macro variable that will be referenced during proc import to ensure that SAS looks at all observations before importing a column. This slows the import process, but is necessary to ensure that columns are correctly identified as character or numeric. */ data _null_; infile bhcfdata; input ; call symput("nvar",_n_); run; %put &nvar; /* This step imports the data, relying on SAS for the heavy lifting. */ PROC IMPORT OUT= WORK.bhcfYYMM /* Replace YYMM with the file you are importing. */ DATAFILE= bhcfdata DBMS=DLM REPLACE; DELIMITER='^'; GETNAMES=YES; DATAROW=3; guessingrows=&nvar; run; /* Once the proc import step is complete, a dataset will be available in the work library. */ /* This program can be expanded to a macro that reads a specified directory, creates file refs to the delimited files inside, and imports them one by one. */