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 (March 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 17 Mar 2005 14:30:58 -0500
Reply-To:     "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Chang Y. Chung" <chang_y_chung@HOTMAIL.COM>
Subject:      Re: What is the regular expression for SAS format name?
Comments: To: Lei Zhang <lzhang9830@YAHOO.COM>

On Thu, 17 Mar 2005 11:13:33 -0800, Lei Zhang <lzhang9830@YAHOO.COM> wrote:

>Hi Richard and Gary, > Thanks a lot for your kind message. It helps me a lot! What I >want to do is to parse >a SAS format statement separated by a SAS format. For example, > >For example: > "a b c 2.8 e f g $fmt. u v w $abc12.1 a b c A1224.123 >$char8.2" > will be parsed into > a b c due to 2.8 > e f g due to $fmt. > u v w due to $abc12.1 > a b c A1234.123 due to $char8.2 > >I came up with a RE as follow > '/\$?[_a-zA-Z]\w{0,31}\.\d{0,2}/' >as the separator of a Format-like string, but it does not always work >at all kinds of situations. > >Your advice will be very much appreciated. Thanks

Hi, LZ,

As long as your values can be a number with a decimal point, I don't think this is possible. This is simply because there is no way of telling if the following is a numeric format or a value:

2.0 1. 5.2

Whoever requested making the "F" in front of the default numeric format optional, did not think about it careful enough. I think this is one of the reasons why we cannot do something like:

data _null_; put 3.2; run;

instead we have to do:

data _null_; a = 3.2; put a; run;

Simply because sas does not know what "2.3" is. Similarly the enhanced editor is having hard time to syntax color it.

Cheers, Chang


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