Unfortunately, scan function treat contiguous delimiters
as one, therefore, simply scan by ':' won't work. But we
can do some preparation before we feed the data to scan:
17 data _null_;
18 length lvar $100;
21 do i=1 to length(var1);
22 if i< length(var1) and substr(var1,i,2)='::' then
24 else lvar=compress(lvar||substr(var1,i,1));
26 put var1= / lvar=;
27 array v(8) var2-var9;
28 do i=1 to 8;
31 put (var2-var9) (=);
var2=5365 var3=6.82 var4=. var5=5.82 var6=85 var7=. var8=. var9=.
The first do loop translate "::" into ":.:",
so that the second do loop can use scan() to separate the fields.
Hope this helps
BTW, next time, put some subject line in your post,
so that may not delete it by default.
From: Liu, Guoyi [mailto:LiuG@NJC.ORG]
Sent: Monday, January 06, 2003 9:31 AM
Happy new year! This is Guoyi Liu from Colorado, I posted a question to
listserv several month ago. I have a question about SAS data management
aagain, I am not sure if someone could help me again. My queston is below.
Var1="5365:6.82::5.82:85:::" Format is Char.
between two ':' there is a missing value. How can I seperate them to
var2 var3 var4 var5 var6 var7 var8 var9
5365 6.82 . 5.82 85 . . .
Thank you very much.