| Date: | Tue, 20 Feb 2007 17:50:54 -0500 |
| Reply-To: | Roland Rivers <seatedcoin@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Roland Rivers <seatedcoin@GMAIL.COM> |
| Subject: | Re: Creating a SAS Dataset from Excel |
|---|
JS,
Did you inadvertantly post your reply to the wrong post? It doesn't seem
like your response is at all related to my original post. Maybe I am
missing something. :)
========================================================================
On Tue, 20 Feb 2007 12:14:54 -0600, Huang, JS <Huang.JS@PRINCIPAL.COM>
wrote:
>With the new information the original code should be modified as the
>following.
>
>data test;
> input ID event_date: Date9. event;
> format event_date Date9.;
>datalines;
> 1 8-Dec-95 1
> 1 16-Dec-95 2
> 1 17-Dec-95 3
> 1 25-Dec-95 4
> 1 31-Dec-95 5
> 2 13-Nov-95 1
> 2 14-Nov-95 2
> 2 15-Nov-95 3
> 2 21-Dec-95 4
> 2 28-Dec-95 5
> 3 18-Dec-95 1
> 4 19-Dec-95 1
> 4 20-Dec-95 2
> 4 27-Dec-95 3
> 5 22-Dec-95 1
> 6 23-Dec-95 1
> 7 20-Feb-95 1
> 7 23-Feb-95 2
> 7 26-Feb-95 3
>;;;;
>
>proc sort data=test;
> by ID event-date;
>run;
>
>data Result(drop=LastEventDate);
> set test;
> by ID;
> retain LastEventDate;
> if first.ID then do;
> LastEventDate=event_date;
> output;
> end;
> else do;
> if event_date gt LastEventDate + 5 then do;
> LastEventDate=event_date;
> Output;
> end;
> end;
>run;
>proc print;
>run;
>
>***** Output *****
> The SAS System 10:32
>Tuesday, February 20, 2007 8
>
> event_
> Obs ID date event
>
> 1 1 08DEC1995 1
> 2 1 16DEC1995 2
> 3 1 25DEC1995 4
> 4 1 31DEC1995 5
> 5 2 13NOV1995 1
> 6 2 21DEC1995 4
> 7 2 28DEC1995 5
> 8 3 18DEC1995 1
> 9 4 19DEC1995 1
> 10 4 27DEC1995 3
> 11 5 22DEC1995 1
> 12 6 23DEC1995 1
> 13 7 20FEB1995 1
> 14 7 26FEB1995 3
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>Roland Rivers
>Sent: Tuesday, February 20, 2007 11:36 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: Creating a SAS Dataset from Excel
>
>I have the following spreadsheet which looks something like the example
>below. The spreadsheet will always look the same except a person can add
>new numeric codes for certain drugs to the list. I need to write some
>SAS code to read in the Excel spreadsheet which I know how to do using
>PROC IMPORT but then pick off the Drug Names and codes and put them in a
>SAS dataset. Although codes can be added in the future there will always
>be at least one space between the last code and the "Comments:" text.
>
>Example Excel Spreadsheet:
>
>AE criteria:
>CT criteria:
>Lab criteria:
>
>
>Drug Name code
>
>Aspirin 123456789
>Robitussin 555555555
>.
>.
>.
>.
>etc.
>
>
>Comments:
>
>
>-----Message Disclaimer-----
>
>This e-mail message is intended only for the use of the individual or
>entity to which it is addressed, and may contain information that is
>privileged, confidential and exempt from disclosure under applicable law.
>If you are not the intended recipient, any dissemination, distribution or
>copying of this communication is strictly prohibited. If you have
>received this communication in error, please notify us immediately by
>reply email to Connect@principal.com and delete or destroy all copies of
>the original message and attachments thereto. Email sent to or from the
>Principal Financial Group or any of its member companies may be retained
>as required by law or regulation.
>
>Nothing in this message is intended to constitute an Electronic signature
>for purposes of the Uniform Electronic Transactions Act (UETA) or the
>Electronic Signatures in Global and National Commerce Act ("E-Sign")
>unless a specific statement to the contrary is included in this message.
>
>While this communication may be used to promote or market a transaction
>or an idea that is discussed in the publication, it is intended to provide
>general information about the subject matter covered and is provided with
>the understanding that The Principal is not rendering legal, accounting,
>or tax advice. It is not a marketed opinion and may not be used to avoid
>penalties under the Internal Revenue Code. You should consult with
>appropriate counsel or other advisors on all matters pertaining to legal,
>tax, or accounting obligations and requirements.
|