🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Obsidian | Level 7

## How To Re arrange numbers in row wise ???

``````I Have dataset like below..

data stansys;
infile datalines;
input string \$22.;
datalines;
two numbers 1 2
five numbers 3 4 5 6 7
three numbers 8 9 10
;
run;

Through this dataset i want output dataset have variable name " Number" it have values like

1

2

3

4

5

6

7

8

9

10

like this only...

Please anyone help us to this programme``````

1 ACCEPTED SOLUTION

Accepted Solutions
Tourmaline | Level 20

## Re: How To Re arrange numbers in row wise ???

Like this?

``````data want(keep=w);
set stansys;
do i = 1 to  countw(string);
w = scan(string, i);
if prxmatch('/\b\d+\b/', w) then output;
end;
run;``````

Result:

```w
1
2
3
4
5
6
7
8
9
10```

4 REPLIES 4
Tourmaline | Level 20

## Re: How To Re arrange numbers in row wise ???

Like this?

``````data want(keep=w);
set stansys;
do i = 1 to  countw(string);
w = scan(string, i);
if prxmatch('/\b\d+\b/', w) then output;
end;
run;``````

Result:

```w
1
2
3
4
5
6
7
8
9
10```

Obsidian | Level 7

## Re: How To Re arrange numbers in row wise ???

Any Another type programme we have for this same question ???
Meteorite | Level 14

## Re: How To Re arrange numbers in row wise ???

Here is another approach:

``````data want (keep=number);
set stansys;
do i=1 to countw(compress(string,"","Kd"));
number = scan(compress(string,"","Kd"),i);
output;
end;
run;``````
Obsidian | Level 7

## Re: How To Re arrange numbers in row wise ???

Thank You Very Much 🙂

Discussion stats
• 4 replies
• 515 views
• 1 like
• 3 in conversation