OK, so I am trying to parse specific strings of numbers into individual variables so that I have for example
Here is my problem, if I try to use the index or Rxparse functions for the characters '10' I still get a 1 if 1 is anywhere in the string. Is there a way to do a literal string match that matches exactly the '10' but not the '1'
Have you looked at the SCAN function???? If the numbers are -reliably- delimited by ',' (comma), then I'd recommend SCAN...probably inside a do loop. I treated the initial "line" of comma separated data as a character string and then used the SCAN function to split out the numbers. Automatic conversion took place from character to numeric -- which you may want to further control with an INPUT function in the assignment statement. But for a simple example, I didn't bother with an INPUT. I also only showed the comma as a delimiter for the SCAN -- it has a set of defaults that it would otherwise use. You can find those in the doc. The only downside to SCAN that I can think of is that 2 contiguous delimiters would be treated as 1 delimiter.
If you already have the data in a character variable, then SCAN is what I'd recommend.
If you have the data in a CSV file and want to READ the data into SAS, then I'd recommend using the delimiter= option on the infile statement. Both techniques are shown below.
**1) Use SCAN function on character string of numbers delimited by commas;
length nline $100;
input nline $;
array sv num1-num20;
do i = 1 to dim(sv);
sv(i) = scan(nline,i,',');
proc print data=separate;
**2) READ data into numeric vars;
infile datalines delimiter=',' missover;