Date: Fri, 13 Feb 2004 08:36:56 -0500
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Prefix blanks
COMPRESS will remove embedded (internal, neither leading nor trailing)
blanks. That was not specified. The LEFT function will remove leading
blanks only.
On Mon, 24 May 2004 12:12:14 +0530, Arun X Kumar <Arunk@DELHI.TCS.CO.IN>
wrote:
>Hi,
>For problem A compress function can be used as
>data a1;
>set a;
>y=compress(x,'');
>run;
>For problem B, apart from array(as suggested by Lars), %do loop can also
>be used as
>
>
>%macro aaa;
>data new ;
> set old ;
>%do i=1 %to 200;
> newvar&i = input (oldvar&i, 12.);
>%end;
>run;
>%mend aaa;
>%aaa
>
>
>
>Arun Kumar
>ACDO2002
>Tata Consultancy Services
>C-56, Noida Phase-2, Noida
>Phone: +91 120 2461001(Extn-1102)
>
>
>
>
>
>
>Sun Bow <sunbow4u@HOTMAIL.COM>
>Sent by: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
>02/13/2004 11:20 AM
>Please respond to Sun Bow
>
>
> To: SAS-L@LISTSERV.UGA.EDU
> cc:
> Subject: Prefix blanks
>
>
>Hi,
>Problem A:
>
>In one of my dataset the values of variables have blanks in prefix ie its
>like ' 16 (say 10 balnks before numbers). Is there a way to
>remove them?
>
>Problem B:
>The same dataset has more than 200 variables. I used
>newvar1 = input (oldvar1, 12.);
>.......
>newvar200 = input (oldvar200, 12.);
>to convert all these character to numeric. I am sure there is a much
>efficient way to do this but I am quite new to SAS.
>
>Will appreciate help.
>
>Sunbow
|