Date: Sun, 8 Mar 2009 23:48:20 -0700
Reply-To: Daniel Nordlund <djnordlund@VERIZON.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Daniel Nordlund <djnordlund@VERIZON.NET>
Subject: Re: Program Error
In-Reply-To: <76d141be-2b52-4b0e-bd0d-fb16efd9a4b1@o11g2000yql.googlegroups.com>
Content-type: text/plain; charset=iso-8859-1
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On
> Behalf Of SAS Illiterate
> Sent: Sunday, March 08, 2009 11:26 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Program Error
>
> Can someone help me with error in this program
>
> data ndc;
>
> infile datalines dlm=",-*";
> input age ndc_code;
> dosage = find(ndc_code, 2, "-");
> do while dosage = "*";
> dosage = substr(dosage, 2);
> end;
> if ((age <= 10) and (numdosage > 5)) then
> dosage_error = 1;
> end;
> datalines;
> 10, 12345-015-12
> 10, 12345-005-12
> 10, 12345-001-12
> 10, 12345-*15-12
> 10, 12345-*5-12
> 10, 12345-*45-12
> 10, 12345-*1-12
> 20, 12345-*25-12
> 20, 12345-*5-12
> 20, 12345-*1-12
> 20, 12345-*25-12
> run;
Well, at least you gave us a program, but you didn't tell us what the error
was or what you wanted as the output. I ran your code, and there were a
number of syntax errors. 1. Do While requires () around the while
condition; 2. the find function is misspecified; 3. you have an unneeded
"end;" just before the datalines directive (or you are missing a DO; after
the IF-THEN).
Can you describe what it is you are trying to do, and what you want the
dataset 'ndc' to look like?
Dan
Daniel Nordlund
Bothell, WA USA
|