hello sir, i may need your further help. i am not that familiar with macro that much. so if you can give me value to put in - would appreciate your time...my detail is as below... i have 2 folder and each contains 47 txt files. for now i am trying to pull up data for 2 states only. rhode island (ri) and delaware (de) for testing purpose... ri - "C:\Documents and Settings\xyz\Desktop" de - "C:\Documents and Settings\xyz\Desktop" can you please correct my value i ahve put if its not correct... Thanks. /*before i go ahead and run the code i wants to make sure i am putting correct value in the code that you have provided -Thanks*/ %macro _wordcntC(ri,de); /*Here ri and de are the fodlers and each foldes has 47 .txt file*/ %global wrd_cnt; %let wrd_cnt=%sysfunc(countw(%nrquote(&ri,de),%str(,))); %put "# of words in list are &wrd_cnt"; %mend _wordcntC; ****** keep what is above ****************; %let _states="ri,de"; %let _dsnlst=ri,de; %_wordcntC(&_states); %macro read_txtFiles(ri,de); %local state; %do j = 1 %to &wrd_cnt; %let word=%qscan(%nrquote(&states),&j,%str(,)); %let _dsn=%qscan(%nrquote(&_dsnlst),&j,%str(,)); PROC IMPORT OUT=&dsn DATAFILE=&_dsn..txt; SCANTEXT=YES; USEDATE=YES; SCANTIME=YES; RUN; proc append base=_allstates data=&syslast force; run; proc datasets lib=WORK; delete &dsn; quit; filename _all_ clear; run; %end; %mend read_txtFiles; %read_txtFiles(&_states);
... View more