LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (July 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Jul 2005 14:08:00 -0400
Reply-To:     Nathaniel_Wooding@DOM.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Nat Wooding <Nathaniel_Wooding@DOM.COM>
Subject:      A case when the location of a format statement in a data step is
              important
Comments: cc: Royce_Claytor@dom.com, Joanne Einsmann <jeinsman@hsc.vcu.edu>,
          myersj@hsc.vcu.edu
Content-Type: text/plain; charset="US-ASCII"

I normally consider the location of a format statement within the boundaries of a data step to not affect the application of the format to variables created within that data step but I just discovered that this is not so.

Consider the program

data a; d1=10073;

d2=16540; format d: mmddyy10.; d3=16666; proc print;run;

I have tested this under WIN NT, 8.2 and 9.1.3 as well as OS/390, V 8.2. In all cases, the format is applied to d1 and d2 but NOT to d3. Of course, if I were to include the complete name of a new variable in the format statement, then it would be added to the Program Data Vector. However, it appears from the program above, the format is applied to all of the existing variables that begin with "D" at the time that the format statement is parsed but the format is not applied to the rest of them as they appear or at the end of the construction of the PDV.

Of course, the work-around is simple: stick the format at the end; however, this may annoy those who feel that formats should go up front in a specific area of the data step. An alternative is to list the variables explicitly which means that I have to give up a useful, if weakly documented feature.

I just spoke to tech support and the consultant verified what I was seeing. He did not find any usage notes and gave me a tracking number (US 6244788).

Mind you, he checked and did not find any such use of the colon modifier listed in the Proc Format documentation.

Nat Wooding

----------------------------------------- CONFIDENTIALITY NOTICE: This electronic message contains information which may be legally confidential and/or privileged and does not in any case represent a firm ENERGY COMMODITY bid or offer relating thereto which binds the sender without an additional express written confirmation to that effect. The information is intended solely for the individual or entity named above and access by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution, or use of the contents of this information is prohibited and may be unlawful. If you have received this electronic transmission in error, please reply immediately to the sender that you have received the message in error, and delete it. Thank you.


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