Date: Wed, 25 Oct 2006 05:09:48 -0400
Reply-To: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject: Re: Saving proc contents for more datasets in one file
Beste Lieuwe,
A few remarks:
>data data.files;
>length file $8;
>input file;
>
>datalines;
>file1
>file2
>file3; * semicolon must be on separate line;
>run; * if not then log has ERROR;
PROC PRINT DATA=Data.Files; RUN; * always good to check read result;
>
>data data.files (drop=total); * DATA _NULL_, you create copy;
>set data.files;
>total + 1; * counting records? NOBS option with SET;
> call symputx('last',total); * creating and overwriting at every record;
* implicit type conversion, Total is num.;
>run; * Alternatively and more efficient;
DATA _NULL_;
IF 0 THEN SET data.files NOBS=Total; * compiled, never executed;
CALL SYMPUT ('last', COMPRESS(PUT(Total,BEST12.)));
STOP; * first iteration;
RUN;
%PUT Always good to check the result: Last=&Last;
Now for the contents, example with PROC CONTENTS:
DATA _NULL_;
SET data.files;
CALL EXECUTE ('PROC Contents DATA=' || COMPRESS(File) || ';RUN;');
RUN;
Alternatively you might use PROC DATASETS and print the contents of more
(all) datasets in a library at once, see your PROC DATASETS documentation.
You'll get the results in the output window if you run interactively and in
an output (.lst file) if you run in batch mode. To always send such output
to a disk file use PROC PRINTTO, see your documentation.
Regards - Jim.
--
Jim Groeneveld, Netherlands
Statistician, SAS consultant
home.hccnet.nl/jim.groeneveld
On Wed, 25 Oct 2006 01:28:34 -0700, BitByte <lieuwe.de.haan@GMAIL.COM> wrote:
>Dear all,
>
>I have a wish but have no idea how to work things out. I have the
>folowing
>
>data data.files;
>length file $8;
>input file;
>
>datalines;
>file1
>file2
>file3;
>run;
>
>data data.files (drop=total);
>set data.files;
>total + 1;
> call symputx('last',total);
>run;
>
>Now the problem starts....
>
>How do I create a do loop that creates a proc contents and appends this
>output for all of these datasets in one file...
>
>I hope someone has brighter ideas than me at this point
>
>
>Greetings Lieuwe
|