- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys
Below dataset split into three datasets like alphabet , digits ,special characters
using compress function i do not know exactly scan function can do this scenario
data special_char;
x='abacd123=@7!*#$ ^';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Is there an actual question here?
What is it that you want to do with that dataset?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What should the three resulting datasets look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
split into three datasets
alphabet digits special characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You want three datasets? Not three variables (one for each class of character)?
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set
Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets
--------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It seems we even have to write your questions for you.
Do you mean to have three datasets, each with a character variable x,
where the first contains
abacd
the second
123
and the third
=@7!*#$ ^
?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data char digit special;
x='abacd123=@7!*#$ ^';
char=compress(x,,'ak');
digit=compress(x,,'kd');
specialchar=compress(x,,'kp');
run;
i do not know how to keep special characters using compress function
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You already have everything you need, you just need to use it "the other way round".
So ask yourself first: "what does the modifier string 'ak' do?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
But that code just creates three duplicates of the same dataset.
If 'ka' keeps alpha and 'kd' keeps digits then to get everything else use 'ad' without the k.