LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 8 Oct 2004 23:06:43 -0700
Reply-To:   Rune Runnestoe <rune@FASTLANE.NO>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Rune Runnestoe <rune@FASTLANE.NO>
Organization:   http://groups.google.com
Subject:   Re: Checking filenames
Content-Type:   text/plain; charset=ISO-8859-1

Thanks, it helped a lot, even though I don't understand the necessity of the dataset Combi. Here is my present solution: %let lib = work; filename top_fn = D:\rune;

%macro test_filename; %find_topical_filename; %find_valid_filename; %find_missing_filename; %find_not_valid_filename; %mend;

%macro find_topical_filename; data &lib..fn_topical; length filename $32.; infile akt_fn; input filename; run; %mend;

%macro find_valid_filename; proc sql; create table &lib..fn_valid (fnamn varchar(32));

insert into &lib..fn_valid values('INFO.TXT') values('INNHOLD.TXT') values("SAK.DAT") values("DOK.DAT") values("ARKIV.DAT") values("RAPPORT\SAKDAT.DAT") values("RAPPORT\JOURNAL.DAT") ; run; %mend;

%macro find_missing_filename; proc sql; create table &lib..fn_missing as select fnamn as filename from &lib..fn_valid where fnamn not in( select filename from &lib..fn_topical); run; %mend;

%macro find_not_valid_filename; proc sql; create table &lib..fn_not_valid as select filename from &lib..fn_topical where filename not in( select fnamn from &lib..fn_valid); run; %mend;

%test_filename;

----------------- The actual filenames in "D:\rune"are as follows: arkiv.dat SAK.DAT DOK.DAT RAPPORT\SAKDOK.DAT RAPPORT\JOURNAL.DAT

"RAPPORT" is a catalog within "rune".

How do I justify the macro "find_topical_filename" in such a way that it makes a recursive search in the catalog "rune" and fetches all the paths there might be ?

Regards Rune

bardos2@ANSYS.CH (Robert Bardos) wrote in message news:<JHEEIGIGFPGACEGDPJMGAELIDPAA.bardos2@ansys.ch>... > Hi Rune, > > sounds like a good candidate for a merge with the in= option. Like so: > > %let lib = work; > filename lsin pipe 'dir c:\temp\rune /a:-d /b'; > data &lib..allfiles; > length name $32.; > infile lsin; > input name; > run; > data &lib..valid_and_compulsory_filenames; > infile cards truncover; > input name $char32.; > cards; > SAK.DAT > DOK.DAT > ARKIV.DAT > SAKDAT.DAT > JOURNAL.DAT > ; > run; > proc sort data=&lib..allfiles; by name; run; > proc sort data=&lib..valid_and_compulsory_filenames; by name; run; > data combi; > merge &lib..allfiles (in=in_all) > &lib..valid_and_compulsory_filenames (in=in_vc); > by name; > in_flags = 10*in_all + in_vc; > format in_flags z2.; > put in_flags= name=; > run; > > Kind regards > > Robert Bardos > Ansys AG, Switzerland > > -----Ursprüngliche Nachricht----- > Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von > Rune Runnestoe > Gesendet: Freitag, 1. Oktober 2004 12:25 > An: SAS-L@LISTSERV.UGA.EDU > Betreff: Re: Checking filenames > > > Hi, > The issue is in two parts. The first is to find out if there are any > filenames in a catalog that are not supposed to be there. The second > is to check if filenames which are supposed to be in the catalog, is > _not_ there. > > Wouldn't it be a good idea to read the filenames that are both valid > and compulsory into a dataset, like this: > data &lib..valid_and_compulsory_filenames; > infile cards truncover; > input name $char32.; > cards; > SAK.DAT > DOK.DAT > ARKIV.DAT > SAKDAT.DAT > JOURNAL.DAT > ; > run; > > And further on, read the topical filenames into another dataset, for > instance > > data &lib..topical_filenames; > ..some code; > run; > > And then I could find which files in "topical_filenames" that are not > in "valid_and_compulsory_filenames" and which ones the other way > around. > > But how shall I write "..some code" in the dataset "topical_filenames" > ? > > Regards > Rune


Back to: Top of message | Previous page | Main SAS-L page