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 (August 2005, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Thu, 4 Aug 2005 07:15:02 -0700
Reply-To:   Nancy Li <nancy_li66@YAHOO.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Nancy Li <nancy_li66@YAHOO.COM>
Subject:   Re: please help convert text notes to SAS
In-Reply-To:   <668936B243AC5F4DB61EAE1878E93027014074A5@mailbe1.westat.com>
Content-Type:   text/plain; charset=iso-8859-1

Thank you for those who replied to my question. I combined all your suggestions together and use the following code, it works well.

Thanks again!

Nancy

data one; length notes $1500; infile 'C:\test.txt' dsd missover lrecl=1500 pad; input value $1500.; note=right(value); retain allnotes; allnotes=compbl(allnotes || note); put allnotes; run;

Randy Herbison <RandyHerbison@westat.com> wrote: Nancy,

If you have leading blanks in the text, and you would like to retain the leading blanks, then change the assignment statement to:

value = trim(value) || _infile_;

If you do not wish to retain leading blanks, then left justify _infile_:

value = trim(value) || left(_infile_);

RandyHerbison@westat.com

-----Original Message----- From: owner-sas-l@listserv.uga.edu [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Nancy Li Sent: Wednesday, August 03, 2005 4:46 PM To: sas-l@listserv.uga.edu Subject: please help convert text notes to SAS

I have a text file with multiple lines, I would like to convert this text file to SAS and make these multiple lines notes into one variable. I used the following code, but it doesn't work as what I expected. Can anybody help me with this? Thanks!

data _null_;

length value $2000;

infile 'C:\test.txt' dsd missover lrecl=1500;

input;

retain value;

value = trim(left(value || _infile_));

put value;

run;

Nancy

The text notes are as the following:

Is on Section 8 has 2 PCA is covered except 3-4 hours/day

- has fallen ? if possable fall a call alert alarm

- W/C bound unable to bear wt.related to spinal cord surgery @ level C-4&5 only has minimal use of both upper extremities

lives in a 2 story apt. -bums her way up the stairs ( her wt is 290 ) discussed electric chair for stairs - landlord would not approve -

discussed other independent living apts -states she has looked into it but has an 11yo chow and any housing she found that would accept animals would not accept a chow.

also had some transportation issues stated often would have to wait 3-4 hours for ride

would be interested in one level living that would accept dog

* is not willing to give up dog to move

thank you

Cindy

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


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