Compress() in SAS*
In SAS 9.1.3 , an extra argument (MODIFIER) is added to the SAS character string function COMPRESS and these modifiers modifies the action of the COMPRESSfunction;
Syntax: COMPRESS(<, chars><, modifiers>) ;
Following characters can be used as modifiers.
a – Compress or Delete all upper and lower case characters from String.
ak- Compress or Delete alphabetic characters(1,2,3 etc) from String.
kd- Compress or Delete characters(aplabets) from String.( Keeps only digits).
d – Compress or Delete numerical values from String.
i – Compress or Delete specified characters both upper and lower case from String.
k – keeps the specified characters in the string instead of removing them.
l – Compress or Delete lowercase characters from String.
p – Compress or Delete Punctuation characters from String.
s – Compress or delete spaces from String. This is default.
u – Compress or Delete uppercase characters from String.
See the Example below:
data _null_ ;
string='StudySAS ! 17752. ' ;
string1=compress(string,'') ; *Compress spaces. This is default;
string2=compress(string,'','ak');*Compress alphabetic chars(1,2etc);
string3=compress(string,'','d') ; *Compress numerical values;
string4=compress(string,'','l');*Compress lowercase characters;
string5=compress(string,'','u');*Compress uppercase characters;
string6=compress(string,'S','k');*Keeps only specifiedcharacters;
string7=compress(string,'!.','P');*Compress Punctuations only;
string8=compress(string,'s','i');*upper/lower case specified characters;
string9=compress(string,'','a');*Compress all upper\lower case characters ;
string10=compress(string,'','s') ; * Compress or delete spaces;
string11=compress(string,'','kd') ; *Compress alphabets (Keeps only digits);
put string1= ;
put string2= ;
put string3= ;
put string4= ;
put string5= ;
put string6= ;
put string7= ;
put string8= ;
put string9= ;
put string10=;
put string11=;
run ;
OUTPUT:
string1=StudySAS!17752.
string2=StudySAS
string3=StudySAS!.
string4=SSAS!17752.
string5=tudy!17752.
string6=SSS
string7=StudySAS 17752
string8=tudyA! 17752.
string9=!17752.
string10=StudySAS!17752.
string11=17752
*Source - internet
In SAS 9.1.3 , an extra argument (MODIFIER) is added to the SAS character string function COMPRESS and these modifiers modifies the action of the COMPRESSfunction;
Syntax: COMPRESS(<, chars><, modifiers>) ;
Following characters can be used as modifiers.
a – Compress or Delete all upper and lower case characters from String.
ak- Compress or Delete alphabetic characters(1,2,3 etc) from String.
kd- Compress or Delete characters(aplabets) from String.( Keeps only digits).
d – Compress or Delete numerical values from String.
i – Compress or Delete specified characters both upper and lower case from String.
k – keeps the specified characters in the string instead of removing them.
l – Compress or Delete lowercase characters from String.
p – Compress or Delete Punctuation characters from String.
s – Compress or delete spaces from String. This is default.
u – Compress or Delete uppercase characters from String.
See the Example below:
data _null_ ;
string='StudySAS ! 17752. ' ;
string1=compress(string,'') ; *Compress spaces. This is default;
string2=compress(string,'','ak');*Compress alphabetic chars(1,2etc);
string3=compress(string,'','d') ; *Compress numerical values;
string4=compress(string,'','l');*Compress lowercase characters;
string5=compress(string,'','u');*Compress uppercase characters;
string6=compress(string,'S','k');*Keeps only specifiedcharacters;
string7=compress(string,'!.','P');*Compress Punctuations only;
string8=compress(string,'s','i');*upper/lower case specified characters;
string9=compress(string,'','a');*Compress all upper\lower case characters ;
string10=compress(string,'','s') ; * Compress or delete spaces;
string11=compress(string,'','kd') ; *Compress alphabets (Keeps only digits);
put string1= ;
put string2= ;
put string3= ;
put string4= ;
put string5= ;
put string6= ;
put string7= ;
put string8= ;
put string9= ;
put string10=;
put string11=;
run ;
OUTPUT:
string1=StudySAS!17752.
string2=StudySAS
string3=StudySAS!.
string4=SSAS!17752.
string5=tudy!17752.
string6=SSS
string7=StudySAS 17752
string8=tudyA! 17752.
string9=!17752.
string10=StudySAS!17752.
string11=17752
*Source - internet
Now i got an idea about the compress function and it is very well implement for me thus it is very well done. I also need many more notes and it is very well interesting too.
ReplyDeleteSas Training in Chennai
I simply want to tell you that I’m all new to blogs and truly liked you’re blog site. Very likely I’m likely to bookmark your site .You surely come with remarkable articles. Cheers for sharing your website page.
SAS Training in Chennai | Selenium Training in Chennai
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
DeleteApply for Canada Tourist Visa
All are saying the same thing repeatedly, but in your blog I had a chance to get some useful and unique information, I love your writing style very much, I would like to suggest your blog in my dude circle, so keep on updates.
ReplyDeleteDigital Marketing Company in India
Hi, thank you for sharing this pretty useful blog, from the IT industry survey, Big Data/Analytics is the hot trend with the strong demand of talent in the upcoming years; I think you are making a great choice to pursue a Master degree in this area.
ReplyDeleteRegards,
SAS Training in Chennai
thanks for sharing useful info.
ReplyDeleteIndian Cyber Army’s most awaited internship is live now. Rush to register for Summer Internship 2018 on “ Ethical hacking” and book your seats before it runs out.Candidates have to get themselves registered to be a part of this Internship program. As career in ethical hacking is most in demand.
Thanks for the information.It is really nice .Information security is the set of processes that maintain the confidentiality, integrity and availability of business data in its various forms.In this age of Technology advancement, computer and information technology have not only brought convenience to citizens in modern life but also for policemen & various Government officials of the nation to fight cybercrime through various modus operandi. Indian Cyber Army has been dedicated in fighting cyber crime, striving to maintain law and order in cyberspace so as to ensure that everyone remains digitally safe.Read more:- Information Security
ReplyDeleteGood Post, I am a big believer in posting comments on sites to let the blog writers know that they ve added something advantageous to the world wide web.
ReplyDeleteAuthorized macbook pro service center in Chennai | Macbook pro service center in chennai | iMac service center in chennai | Mac service center in chennai | Macbook pro service center in chennai |
Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.
ReplyDeleteMobile service center in chennai | Mobile display replacement in chennai | 100% genuine mobile parts | Mobile Water damage service | Mobile screen replacement in chennai | 100% genuine mobile parts | Mobile battery replacement in chennai | Mobile unlocking service in chennai | 100% genuine mobile parts | Mobile Service center in chennai |Mobile Water damage service in chennai
Heya just wanted to give you a brief heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different web browsers and both show the same outcome. CNC machine shop edmonton
ReplyDeleteI have to voice my passion for your kindness giving support to those people that should have guidance on this important matter.
ReplyDeleteBest PHP Training Institute in Chennai|PHP Course in chennai
Best .Net Training Institute in Chennai
Dotnet Training in Chennai
Dotnet Training in Chennai