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 (June 2000, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jun 2000 08:44:18 -0400
Reply-To:     "Fehd, Ronald J." <rjf2@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Fehd, Ronald J." <rjf2@CDC.GOV>
Subject:      feature: scan with negative numbers
Content-Type: text/plain; charset="iso-8859-1"

This feature of the scan function was discussed at PNWSUG.

I suppose one could use this in reading last word of a string and not have to use reverse.

15 data test; 16 length Sub1 $ 1 17 Sub2 $ 1 18 Scn1 $ 1 19 Scn2 $ 1; 20 retain S 'abcdefgh' 21 W 'a b c d e f g h'; 22 Sub1 = substr(S,1,1); 23 Sub2 = substr(S,-1,1); 24 Scn1 = scan(W,1);

25 Scn2 = scan(W,-1);

26 put _all_; 27 stop; 28 run;

NOTE: Invalid second argument to function SUBSTR at line 23 column 8. Sub1=a Sub2=a Scn1=a Scn2=h S=abcdefgh W=a b c d e f g h _ERROR_=1 _N_=1 ..........................^

Ron Fehd the macro maven CDC Atlanta GA USA RJF2@cdc.gov ---> cheerful provider of TESTED SAS code!*! <--- archives: http://www.listserv.uga.edu/archives/sas-l.html


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