Funkcja SCAN, dzielenie stringów

Monday, October 20th, 2008 | SAS

Szukałem, szukałem… i znalazłem :)
funkcja SCAN w miły sposób zastępuje zabawę z SUBSTR i INDEX.Ścieżka problemu zapisana w następujący sposób:
problem1 -> problem2 -> problem3-> …

proc sql outobs=3;
select
sciezka_problemu,
scan(sciezka_problemu,1,’->’) as a1,
scan(sciezka_problemu,2,’->’) as a2,
scan(sciezka_problemu,3,’->’) as a3,
scan(sciezka_problemu,4,’->’) as a4,
scan(sciezka_problemu,5,’->’) as a5,
scan(sciezka_problemu,6,’->’) as a6,
scan(sciezka_problemu,7,’->’) as a7
from oprshare.zgloszone_problemy
;quit;

A tutaj przewodnik po funkcjach łańcuchowych SAS:

http://support.sas.com/publishing/pubcat/chaps/59343.pdf

Tags:

No comments yet.

Leave a comment

Search