Help using Base SAS procedures

Import all CSV in folder to sas dataset

Reply
Frequent Contributor
Posts: 145

Import all CSV in folder to sas dataset

I have written macro to import csv file into sas data……I would like to know how to run this macro for all the csv file files located in the folder. All csv file are of same structural format.

libname x 'library location;

option spool;

%let x=/by/data/ad/14607_randlist_2nd_read_part_2_batch_1_session_1_reader_1_03aug12_dummy.csv;

(location of folder)

%macro test(a=);

PROC IMPORT OUT=x.&a

DATAFILE="&x"

    DBMS=CSV REPLACE;

    delimiter = ";";

     GETNAMES=YES;

RUN;

data x.&a;

set x.&a;

a="&x";

part=substr(a,89,1);

order=substr(a,107,1);

eval=substr(a,116,1);

drop a;

run;

%mend;

%test(a=x);

Ask a Question
Discussion stats
  • 0 replies
  • 444 views
  • 0 likes
  • 1 in conversation