LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2010, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 11 Mar 2010 13:20:50 -0500
Reply-To:   Lou <lpogoda@HOTMAIL.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Lou <lpogoda@HOTMAIL.COM>
Organization:   A noiseless patient Spider
Subject:   Re: How to declare variable
Comments:   To: sas-l@uga.edu

>"Jinto83" <jinto83@sina.com> wrote in message >news:hnauiu$2nqm$1@adenine.netfront.net... >Hi, > >2 quick questions. > >1. How to declare a variable? For example, declare VarA=numeric6.2 >Is it using put or input?

The most complete declaration uses the ATTRIB statement. You can do "partial" declarations with statements like LENGTH, FORMAT, and INFORMAT. Or you can not worry about it and let SAS handle the declarations implicitly from context. No guarantees that SAS will assign what you really want.

>2. How to remove all occurence of the symbol ' and the symbol " >Tranwrd in SAS won't take ' or " > >companyname=John's "R" Shop >desiredoutput=Johns R Shop

TRANWRD can handel multiple character string targets, while TRANSLATE works on single character targets, and it appears that you're working with single characters. Either can handle single or double quotes if you quote things properly, though the quoting can cause a case of fumble fingers, like so:

84 data _null_; 85 companyname = "John's " || '"R" Shop'; 86 put companyname=; 87 newname = translate(companyname, ' ', "'", ' ', '"'); 88 put newname=; 89 run;

companyname=John's "R" Shop newname=John s R Shop NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds

--- news://freenews.netfront.net/ - complaints: news@netfront.net ---


Back to: Top of message | Previous page | Main SAS-L page