Dataset desciption of all dataset in the library
%******************************************************************************; %** http://www.info-net.nl **; %******************************************************************************; %* Topic : Reporting *; %* Program : Dataset desciption of all dataset in the library *; %* Author : Raymond Ebben *; %* Location : http://www.info-net.nl/sas-programs/reporting *; %* Date : January 2006 *; %* Version : 1.0 *; %* Description : This program creates a RTF (Word) document containing *; %* the description of the datasets in the specified library *; %* This example uses the library SASHELP Change the macro *; %******************************************************************************; %* In datasets : None *; %* In macrovars : None *; %* In files : None *; %* Out datasets : None *; %* Out macrovars : None *; %* Out files : &outputfile *; %******************************************************************************; %** Version control **; %******************************************************************************; %* Mod * Ver. * Date * Description *; %******************************************************************************; %******************************************************************************; %******************************************************************************; %* Get the name of the library to list *; %******************************************************************************; %let library=sashelp; %******************************************************************************; %* Set the name of the output file *; %******************************************************************************; %let outputfile=e:\description.rtf; %******************************************************************************; %* Get all members of the specified library *; %******************************************************************************; proc contents data=&library.._all_ out=dinfo noprint; quit; %******************************************************************************; %* Sort the data by library member *; %******************************************************************************; proc sort data=dinfo nodupkey; by memname varnum name; run; %******************************************************************************; %* Create a varlen variable for display purposes *; %* and create a record for table headings *; %******************************************************************************; data dinfo; set dinfo; length varlen $10; by memname varnum name; if type=2 then varlen='$'||compress(put(length,8.))||'.'; else varlen=compress(put(length,8.))||'.'; if not missing(format) then format=compress(lowcase(format))||'.'; if format='$.' then format=''; output; if first.memname then do; varnum=-1; name='variable'; varlen='Length'; format='Format'; label='Label'; output; end; run; %******************************************************************************; %* Create the RTF report *; %******************************************************************************; options papersize=A4 nobyline nodate nonumber; title; footnote; %******************************************************************************; %* Setup the ODS parameters *; %******************************************************************************; ods listing close; ods escapechar='#'; ods rtf author='Raymond Ebben' title="Dataset overview for &library" file="&outputfile" startpage=never; %******************************************************************************; %* Print the document containg the comtents of the library *; %******************************************************************************; proc report data=dinfo nowindows noheader missing split= "~" spacing= 1 ; by memname; column memname varnum name varlen format label; define memname / order order=internal noprint ; define varnum / order order=internal noprint ; define name / order " " flow style=[cellwidth=200 font_face='verdana' font_size=9pt]; define varlen / display " " flow style=[cellwidth=100 font_face='verdana' font_size=9pt]; define format / display " " flow style=[cellwidth=200 font_face='verdana' font_size=9pt]; define label / display " " flow style=[cellwidth=500 font_face='verdana' font_size=9pt]; compute before memname /style=[cellwidth=1000 font_face='verdana' font_weight=bold font_size=9pt]; line @1 memname $200.; endcomp; run; ods rtf close; ods listing;
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
© 2010 Raymond Ebben, expert SAS consultant and programmer, Netherlands All Rights Reserved.