🔒 This topic is solved and locked.
Need further help from the community? Please
sign in and ask a new question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 06-10-2016 01:42 PM
(4574 views)
Hello, Is it possible to use the Array and scan together. With the current project I'm working on, I'm currently using the scan function to pull individual variable from a column. For example, here an example of a code I wrote out:
data test;
set temp;
CODE1=scan(CODE,1, ' ');
CODE2=scan(CODE,2,' ');
.
.
.CODE27=scan(CODE,27,' ');
run;
Is it possible to used an 'array' function to simplied this code. Thanks.
1 ACCEPTED SOLUTION
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Of course, it is possible
data test;
set temp;
array c code1-code27;
do i = 1 to dim(c);
c{i} = scan(CODE, i, ' ');
end;
drop i CODE;
run;
PG
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Of course, it is possible
data test;
set temp;
array c code1-code27;
do i = 1 to dim(c);
c{i} = scan(CODE, i, ' ');
end;
drop i CODE;
run;
PG
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The code appears to work, but the variable (CODE) is a character variable and I'm getting the error message mentioning numeric data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Nevermind. I got it to work now. thanks to everyone help.