|
since v6.06, alignment has been a format modifier on put
statements but not in the v6 put() function.
(and during that time I've been plugging for a ballot item/vote for
the alignment modifier to be supported in the put() function )
It was only with the C&E of v8 that the alignment modifier finally
became available .... at last !
In the scl of fsview the format modifiers are not allowed on either
input() or put() functions
To check whether there might be some difference in the scl of sas/af ,
I tried to compile this short piece of scl
+BUILD: SOURCE SASUSER.SCL.PUTMOD.SCL (E)-----------------------+
|00001 /* a program just to test if put() supports modifiers*/ |
|00002 |
|00003 init: |
|00004 dcl num numb1 =14 ; |
|00005 dcl char(15) char1 ; |
|00006 char1 = put( numb1, best8. -L ); |
|00007 return; |
|00008 |
+---------------------------------------------------------------+
But these compile errors show up in the log
NOTE: Compiling PUTMOD.SCL with DEBUG option.
ERROR 79-322: Expecting a ).
ERROR 202-322: The option or parameter is not recognized and will be ignored.
NOTE: SCL source line.
7 char1 = put( numb1, best8. -L );
-
79
-
202
ERROR: Compile error(s) detected. No code generated.
Clearly the alignment feature hasn't made it into SCL (yet ?)
Hope this surprise is no major disappointment to anyone
outside SI.
Regards
Peter Crawford
Datum: 13/02/2002 16:06
An: Peter Crawford/Zentrale/DeuBaExt@Zentrale
SAS-L@LISTSERV.UGA.EDU
Betreff: RE: put alignment (was: Re: help for data manipulation )
Nachrichtentext:
Peter Crawford, in part, wrote:
> Have you tried the alignment format modifier in a put function,
Peter,
No, I have not, since I have had no clue, until now, that it exist. Another
thing I learn here. Thanks for having taught me!
>like
>
> 6 data _null_;
> 7 _n_ = 17 ;
> 8 p = 'p' || put( _n_, best.-L ) ;
> 9 put p=;
> 10 run;
>
> p=p17
>
> brevity, I think you'll appreciate !
Oh yeah!
> It replaces the left() function
> Other alignments available:
> -C for center
> -R for right
Has it been available for a long time now and I have just overlooked it, or
it is something relatively fresh?
> I believe it doesn't work in the scl environment.
I can live with that restriction... not sure about David W., though.
Kind regards,
=====================
Paul M. Dorfman
Jacksonville, FL
=====================
> Regards
> Peter Crawford
>
>
>
> Datum: 12/02/2002 23:38
> An: SAS-L@LISTSERV.UGA.EDU
>
>
>
>
> Antwort an: "Dorfman, Paul" <Paul.Dorfman@BCBSFL.COM>
>
> Betreff: Re: help for data manipulation
> Nachrichtentext:
>
> Sawir,
>
> In this particular case, one could code just
>
> p = 'p' || put(_n_ , 1.) ;
>
> But suppose you have 100 records, so that _n_ can range from
> 1 to 100. If
> you specify 3. to accommodate it, it may not be enough the
> next time when
> your code executes against 1000 records. Best. format tries
> to figure out
> how to print a SAS number in the most informational way. When
> you omit the
> width specification from Best., it defaults to 12, more than
> enough when
> dealing with practically any number of records on a file.
> However, because
> the format is thus wider than the number of digits it prints,
> the following
> occurs:
>
> 309 data _null_;
> 310 _n_ = 17 ;
> 311 p = 'p' || put(_n_ , best.) ;
> 312 put p=;
> 313 run;
>
> p=p 17
>
> The format right-justifies. The intervening blanks should be
> squeezed from
> between p and 17, hence the need for the LEFT function:
>
> 314 data _null_;
> 315 _n_ = 17 ;
> 316 p = 'p' || left (put(_n_ , best.)) ;
> 317 put p=;
> 318 run;
>
> p=p17
>
> Kind regards,
> =====================
> Paul M. Dorfman
> Jacksonville, FL
> =====================
>
>
>
> --
>
> Diese E-Mail enthält vertrauliche und/oder rechtlich
> geschützte Informationen. Wenn Sie nicht der richtige
> Adressat sind oder diese E-Mail irrtümlich erhalten haben,
> informieren Sie bitte sofort den Absender und vernichten Sie
> diese Mail. Das unerlaubte Kopieren sowie die unbefugte
> Weitergabe dieser Mail ist nicht gestattet.
>
> This e-mail may contain confidential and/or privileged
> information. If you are not the intended recipient (or have
> received this e-mail in error) please notify the sender
> immediately and destroy this e-mail. Any unauthorized
> copying, disclosure or distribution of the material in this
> e-mail is strictly forbidden.
>
>
Blue Cross Blue Shield of Florida, Inc., and its subsidiary and
affiliate companies are not responsible for errors or omissions in this e-mail message. Any personal comments made in this e-mail do not reflect the views of Blue Cross Blue Shield of Florida, Inc.
--
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
|