Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data formatting through infile

Status
Not open for further replies.

smalek

Programmer
Jan 15, 2009
28
CA
Hi
I am importing a file through a data infile and the date field is coming in as * "01/04/09". I tried stripping the special characters with a number of manipulations but no success. Any thoughts?
Also my infile is being imported in the following variable sequence
Date Site Pt_Id Mnemonic
01/04/09 ML 123 CBC
1 01603 TEST
01/04/09 ML 456 WBC
1 03015 SPEC

My Desired output is the following:
Date Site PT_ID Mnemonic Count Code Countby
01/04/09 ML 123 CBC 1 01603 TEST
01/04/09 ML 456 CBC 1 03015 SPEC

Any advice is much appreciated?
Thanks
 
Can you show us a sample of your raw data that you import. This looks like SAS is reading some char that tells it to store your second line of data on a new line (record).
Klaz
 
Hi klaz2002
In fact the raw data file is setup such that

1 01603 TEST

1 03015 SPEC

are on a separate line. Due to the number of records it would labourious to go through the raw file and bring these records back up the the parent entry. It is for this reason I would like to run it through SAS to end up with the following desired output:

Date Site PT_ID Mnemonic Count Code Countby
01/04/09 ML 123 CBC 1 01603 TEST
01/04/09 ML 456 CBC 1 03015 SPEC

Thanks
 
Is the raw data set up like this?
Code:
01/04/09         ML              123          CBC
1                01603           TEST
01/04/09         ML              456          WBC
1                03015           SPEC

When you read this type of data into SAS you should use list input.

ex
Code:
data test;
 infile "yourfile";
 input Date Site PT_ID Mnemonic Count  Code  Countby;
run;

This should read the raw data and proceed to the next line when data wraps.

Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top