Date: Fri, 22 Jan 2010 16:27:04 -0500
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Put to split a string into two lines ?
Content-Type: text/plain;charset=iso-8859-1
hi ... one idea ... not written to the LOG but to a file
data x;
input a : $20.;
file 'z:\log.txt';
b = translate(a,'0d'x,'/');
put b;
drop b;
datalines;
one
one/two
one/two/three
one/two/three/four
;
run;
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> He isn't asking that; he's asking how to put it out to the log without
> separate variables.
>
> Ya, I don't know of a way to do this. PUT doesn't operate on (most?)
> functions. You might be able to use some %sysfunc stuff to work around
> that, but it would be much messier than splitting it into variables first.
>
> -Joe
>
> On Fri, Jan 22, 2010 at 2:49 PM, SD_Data_Dude <thompsop@sanfordhealth.org>wrote:
>
>> On Jan 22, 1:28 pm, ya.hu...@AMYLIN.COM (Ya Huang) wrote:
>> > Hi there,
>> >
>> > I have a long string, which has one or more '/' in between the letters,
>> > is there a way to use put statement and get two lines?
>> >
>> > 9 data _null_;
>> > 10 a='first line / second line';
>> > 11 put a=;
>> > 12 run;
>> >
>> > a=first line / second line
>> > NOTE: DATA statement used (Total process time):
>> >
>> > I would like the following though:
>> >
>> > a=first line
>> > second line
>> >
>> > I can certainly break the string apart, and use put like this
>> > put st1 / st2 / st3...
>> > Just wondering if it can be done more easily like split='/' in proc
>> > report?
>> >
>> > Thanks
>> >
>> > Ya
>>
>> Learn about the scan function.
>>
>
|