- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I want to find single quote (') and long hyphen :smileyminus: in a CLOB data.
I used index function but its not working.
When I am trying to keep long hyphen in the sas editor to start programming, it is automatically changed into small hyphen and the program capture record with small hyphen.
Can anyone help me
data abc;
informat string $100.;
input id string &;
cards;
1 patient’s hemoglobin was less than or equal to 11 (units not provided). On an unknown date in May 2013
2 A former school cricket-coach was jailed for 15 months on Thursday for normal@range.
3 A 19 derivation EEG demonstrated theta activity (5−6 c/sec) on right frontal derivations corresponding to the lesion site
4 The neurological examination at'admission showe'd a stuporous state with partial cluster seizures
5 The Singapore Armed Forces (S−A−F) will conduct military exercises in Seletar
;-
Output should be Id number 1, 3 and 5
Advance thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi,
Long hypen or 'em dash ' are special chcarcters ..
Go to MS-word and replace - with — /* i have pasted long hypen from ms word*/
.....go with following code..
data want;
set abc;
if find(trim(string),'—') then _id=id; /* i have pasted long hypen from ms word*/
run;
Regards,
Allu
Message was edited by: Y ALLU
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's a snippet of code I wrote the other day to help someone with a similar problem.
data test;
set your_dataset;
length new_category $5 category1-category3 $7;
category1 = cat('0 ', byte(150), ' 5'); * USE 150 for an EN (short) DASH and 151 for an EM (long) DASH;
category2 = cat('6 ', byte(150), ' 10');
category3 = cat('11 ', byte(150), ' 20');
if Years_Nephrology_ = category1 then new_category='0-5';
else if Years_Nephrology_ = category2 then new_category='6-10';
else if Years_Nephrology_ = category3 then new_category='11-20';
else new_category='> 20';
run;
proc freq ;
tables new_category;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The character printed has more to do with the font than anything.
Here is your sample that shows searching for both a long dash or a short dash.
The results show that only the short dash appears in the text, but that may have been messed up by the editor.
/* test2.sas */
data abc;
informat string $150.;
input id string &;
pos_long = index(string, '96'x); /* long dash */
pos_shrt = index(string,'2D'x); /* short dash */
put string= / string $hex100. /; /* display hex of first 50 characters in log */
cards;
1 patient’s hemoglobin was less than or equal to 11 (units not provided). On an unknown date in May 2013
2 A former school cricket-coach was jailed for 15 months on Thursday for normal@range.
3 deleted stuff (5-6 c/sec) on right frontal derivations corresponding to the lesion site
4 The neurological examination at'admission showe'd a stuporous state with partial cluster seizures
5 The Singapore Armed Forces (S-A-F) will conduct military exercises in Seletar
;
Jan