Date: Mon, 26 Apr 2004 21:11:29 -0400
Reply-To: Lou <lpogodajr292185@COMCAST.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Lou <lpogodajr292185@COMCAST.NET>
Subject: Re: FORMAT questions
"Jack Hamilton" <JackHamilton@FIRSTHEALTH.COM> wrote in message
> It's helpful to include the text of previous messages when you reply. I
> don't know what your questions #1 and #2 were, or what error message you
> were getting.
> Anyway, SASHELP.VFORMAT is available in version 9.1 (possibly in 9.0,
> but I don't know). As far as I know, there's no way to get the names
> of all formats in version 8.2 except typing them in.
Surely we can do better than that. For instance, we can call up the help
system by typing "help formats" on the command line or in the command bar,
choosing "INFORMATS AND FORMATS: index" from the "topics found" box, and
copying and pasting the relevant pages. A little text editing would be
needed to get rid of extraneous material, leaving just the format names.
It'd pretty much have to be quicker than typing in the names from the
I don't quite see the usefulness though - for instance, the $w. format has a
range of 1 to 32,767 characters - that is, this "one" format will expand to
32,767 formats in the series $1., $2., . . . $32767. To use the way the
original poster posited, it's going to be a pretty hefty list.
Which brings up the question - just what does SASHELP.VFORMAT show for a
list of formats?
> You could always
> preceed you format names with a unique prefix. "Year" is, in my
> opinion, a poor name for a format, because it's too general (yearfmt
> would be a worse choice). MyYear would be better.
This is a better idea, but since format names are SAS names up to seven
characters long, and in the case of character formats the first character
must be a dollar sign (which means the name itself is limited to six
characters), and names cannot end in a number, it could be somewhat limiting
and depending on the variable names and chosen prefix (or suffix) could lead
to duplicate format names.
I get the impression the format names are being generated "automagically",
from program code. How about just assigning the format names sequentially?
The format for the first variable could be $C001A, the second $C002A, etc.
for instance. Not very mnemonic, I'll admit, but if the naming scheme is
properly chosen there's no possibility of internal duplication or collision
with system format names, and the FMTLIB option of PROC FORMAT can be used
to print out a description of each format if human reference is needed.