f



Help needed to convert text file to SAS file

Dear all,



I need help to convert the following text file to SAS file. There are two parts for each line which is divided by �:�, the part before �:� will be the variable name and the part after �:� will be the value for the corresponding variable in the final SAS file. (Actually, there is only one line for HealthCoachNotes and Notes respectively in the text file). I want to ignore the second to fourth line, convert the first line, skip over the second to fourth line, and continue to convert the fifth till the end.  Does anybody have any idea how to do it? Any input would highly appreciate.



Thanks in advance!



Sent:            Tuesday, June 28, 2005 3:51 PM

To:            referral@health.com

Subject:            Referral Form



Affordability:            -1

calldate:            6/28/05

CaseMgtReferral:         0

contact dat:            7/20/05

Contacted:            -1

Date of Birth2:            1/19/1960

DateOfCall:            None

DefMemberName:       Smith Barry

DFDOB:            None

Duable Medical Equipment:            0

End of Life:            0

Facility5:            0

Food Stamps:            0

HC Name:            Cindy x 0068

HealthCoachNotes:            Member states she has difficulty affording medications.  She also states that she has a torn rotator cuff and could not get surgery - she is not sure if she needs surgery, but she stated she did not think she could get it if needed.  Mbr is currently finishing up a course of rehab for shoulder & back; multiple mental health issues -sees counselor every other week.  Thank You.  If any questions, please feel free to call me.

Home Health Care (>6 weeks)1:            0

Housing:            0

Insurance/Benefit:         -1

Legal Issues:            0

Medical Equipment:            0

Member3:            0

Mental Health1:            -1

Not Contacted:            0

Nutrition:            0

other resource:            0

Other5: 0

Other7: -1

Notes:  Spoke with member- she is aware she can switch to a different clinic and receive her medications there under the Free Care program- she has seen this PCP for many years and does not want to change doctors.  I sent info to member re:Patient Assistance Program through Abbott for synthroid.  Also sent her an application for Medline- they have access to many more programs that may assist member with costs of meds.

thx

Patient ID:            1000012345

pcp id2:            10006789

Permission9:            0

Phone Day:            (902) 123-4567

Physician name:            Dr xxx xx

Physician3:            0

Plan Name3:            Free Care

Rehab Needs2:            0

Substance Abuse:  0

SW Referral:            0

Transportation:            0

URGENT:            0







---------------------------------
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour
0
nancy_li66 (32)
7/25/2005 8:11:10 PM
comp.soft-sys.sas 142828 articles. 3 followers. Post Follow

2 Replies
628 Views

Similar Articles

[PageSpeed] 27

Hi,

I'm not sure what all converting or parsing
you want to do but here is a method of fetching
the parts and pieces.  If you need more help,
hollar again...


    * read flat file varying length ;
data thedata(drop=pline);
  length pline $2000
         name_part $100
         value_part $1000;
  infile 'c:\temp\myfile.txt' length=lenvar;
  input @1 pline $varying. lenvar;
  if pline eq '' then delete;
  name_part = trim(left(scan(pline,1,':')));
  value_part = trim(left(scan(pline,2,':')));
run;





Hope this is helpful.


Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group


Russell
Global Leaders in Multi-Manager Investing






-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Nancy Li
Sent: Monday, July 25, 2005 1:11 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help needed to convert text file to SAS file


Dear all,



I need help to convert the following text file to SAS file. There are
two parts for each line which is divided by ':', the part before ':'
will be the variable name and the part after ':' will be the value for
the corresponding variable in the final SAS file. (Actually, there is
only one line for HealthCoachNotes and Notes respectively in the text
file). I want to ignore the second to fourth line, convert the first
line, skip over the second to fourth line, and continue to convert the
fifth till the end.  Does anybody have any idea how to do it? Any input
would highly appreciate.



Thanks in advance!



Sent:            Tuesday, June 28, 2005 3:51 PM

To:            referral@health.com

Subject:            Referral Form



Affordability:            -1

calldate:            6/28/05

CaseMgtReferral:         0

contact dat:            7/20/05

Contacted:            -1

Date of Birth2:            1/19/1960

DateOfCall:            None

DefMemberName:       Smith Barry

DFDOB:            None

Duable Medical Equipment:            0

End of Life:            0

Facility5:            0

Food Stamps:            0

HC Name:            Cindy x 0068

HealthCoachNotes:            Member states she has difficulty affording
medications.  She also states that she has a torn rotator cuff and could
not get surgery - she is not sure if she needs surgery, but she stated
she did not think she could get it if needed.  Mbr is currently
finishing up a course of rehab for shoulder & back; multiple mental
health issues -sees counselor every other week.  Thank You.  If any
questions, please feel free to call me.

Home Health Care (>6 weeks)1:            0

Housing:            0

Insurance/Benefit:         -1

Legal Issues:            0

Medical Equipment:            0

Member3:            0

Mental Health1:            -1

Not Contacted:            0

Nutrition:            0

other resource:            0

Other5: 0

Other7: -1

Notes:  Spoke with member- she is aware she can switch to a different
clinic and receive her medications there under the Free Care program-
she has seen this PCP for many years and does not want to change
doctors.  I sent info to member re:Patient Assistance Program through
Abbott for synthroid.  Also sent her an application for Medline- they
have access to many more programs that may assist member with costs of
meds.

thx

Patient ID:            1000012345

pcp id2:            10006789

Permission9:            0

Phone Day:            (902) 123-4567

Physician name:            Dr xxx xx

Physician3:            0

Plan Name3:            Free Care

Rehab Needs2:            0

Substance Abuse:  0

SW Referral:            0

Transportation:            0

URGENT:            0







---------------------------------
Yahoo! Mail
 Stay connected, organized, and protected. Take the tour
0
mterjeson (1913)
7/25/2005 9:07:05 PM
Thanks for answering my question, that has been solved.

Thanks!

Nancy

"Terjeson, Mark (IM&R)" <Mterjeson@russell.com> wrote:
Hi,

I'm not sure what all converting or parsing
you want to do but here is a method of fetching
the parts and pieces. If you need more help,
hollar again...


* read flat file varying length ;
data thedata(drop=pline);
length pline $2000
name_part $100
value_part $1000;
infile 'c:\temp\myfile.txt' length=lenvar;
input @1 pline $varying. lenvar;
if pline eq '' then delete;
name_part = trim(left(scan(pline,1,':')));
value_part = trim(left(scan(pline,2,':')));
run;





Hope this is helpful.


Mark Terjeson
Senior Programmer Analyst, IM&R
Russell Investment Group


Russell
Global Leaders in Multi-Manager Investing






-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
Nancy Li
Sent: Monday, July 25, 2005 1:11 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help needed to convert text file to SAS file


Dear all,



I need help to convert the following text file to SAS file. There are
two parts for each line which is divided by ':', the part before ':'
will be the variable name and the part after ':' will be the value for
the corresponding variable in the final SAS file. (Actually, there is
only one line for HealthCoachNotes and Notes respectively in the text
file). I want to ignore the second to fourth line, convert the first
line, skip over the second to fourth line, and continue to convert the
fifth till the end. Does anybody have any idea how to do it? Any input
would highly appreciate.



Thanks in advance!



Sent: Tuesday, June 28, 2005 3:51 PM

To: referral@health.com

Subject: Referral Form



Affordability: -1

calldate: 6/28/05

CaseMgtReferral: 0

contact dat: 7/20/05

Contacted: -1

Date of Birth2: 1/19/1960

DateOfCall: None

DefMemberName: Smith Barry

DFDOB: None

Duable Medical Equipment: 0

End of Life: 0

Facility5: 0

Food Stamps: 0

HC Name: Cindy x 0068

HealthCoachNotes: Member states she has difficulty affording
medications. She also states that she has a torn rotator cuff and could
not get surgery - she is not sure if she needs surgery, but she stated
she did not think she could get it if needed. Mbr is currently
finishing up a course of rehab for shoulder & back; multiple mental
health issues -sees counselor every other week. Thank You. If any
questions, please feel free to call me.

Home Health Care (>6 weeks)1: 0

Housing: 0

Insurance/Benefit: -1

Legal Issues: 0

Medical Equipment: 0

Member3: 0

Mental Health1: -1

Not Contacted: 0

Nutrition: 0

other resource: 0

Other5: 0

Other7: -1

Notes: Spoke with member- she is aware she can switch to a different
clinic and receive her medications there under the Free Care program-
she has seen this PCP for many years and does not want to change
doctors. I sent info to member re:Patient Assistance Program through
Abbott for synthroid. Also sent her an application for Medline- they
have access to many more programs that may assist member with costs of
meds.

thx

Patient ID: 1000012345

pcp id2: 10006789

Permission9: 0

Phone Day: (902) 123-4567

Physician name: Dr xxx xx

Physician3: 0

Plan Name3: Free Care

Rehab Needs2: 0

Substance Abuse: 0

SW Referral: 0

Transportation: 0

URGENT: 0







---------------------------------
Yahoo! Mail
Stay connected, organized, and protected. Take the tour

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
0
nancy_li66 (32)
7/26/2005 3:28:29 PM
Reply: