Date: Wed, 14 Jun 2006 11:18:37 -0400
Reply-To: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jim Groeneveld <jim2stat@YAHOO.CO.UK>
Subject: Re: SAS 101
and additionally (or alternatively) to what Gerhard wrote, change your
input var1 var2;
You want to read all values into Var1 and next to that you create Var2.
But with your original code every other value was read into Var1 and every
other value in between was read into Var2. Gerhard's suggestion prevents
reading the values into Var2, but you actually have no Var2 to read.
The reason your original code did not even read the value 20 is:
it actually read the value 20 into Var1 and then wanted to read another
value into Var2. But there wasn't a value to read anymore, so the data step
stopped without outputting the read value.
Regards - Jim.
Jim Groeneveld, Netherlands
Statistician, SAS consultant
On Wed, 14 Jun 2006 10:00:53 -0500, Thomas A. Schmitt <schmitta@UWM.EDU> wrote:
>Thanks for the responses the "Efficient Code" question and for the reference
>to David Carradine. That takes me back.:)
>I have another question. I'm trying to input a constant into a data file as
>in the example data files below. I can do this if there are "values" for
>var2, but it doesn't work if there is either a space or no space. SAS is
>giving me the following error message with the program below. I'm curious as
>to what SAS is telling me with the error message, why it SAS is outputting
>every-other value and stopping at 18 and for the solution.
>infile 'C:\Documents and Settings\Administrator\Desktop\data.txt';
> input var1 var2;
>proc print data=test;
>Original data file
>What I want it to look like
>What SAS is outputting:
>Obs var1 var2
>1 12 10
>2 14 10
>3 16 10
>4 18 10
>The error message:
>NOTE: LOST CARD.
>var1=20 var2=. _ERROR_=1 _N_=5
>NOTE: 9 records were read from the infile 'C:\Documents and
> The minimum record length was 3.
> The maximum record length was 3.
>NOTE: SAS went to a new line when INPUT statement reached past the end of a
>NOTE: The data set WORK.TEST has 4 observations and 2 variables.