LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2006, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
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
Comments: To: Tom Schmitt <schmitta@UWM.EDU>

Hi Thomas,

and additionally (or alternatively) to what Gerhard wrote, change your input var1 var2; into input var1;

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 home.hccnet.nl/jim.groeneveld

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. > >Thanks, > >Tom > >data test; >infile 'C:\Documents and Settings\Administrator\Desktop\data.txt'; > input var1 var2; > var2=10; >run; >proc print data=test; >run; > > > >Original data file > >12 >13 >14 >15 >16 >17 >18 >19 >20 > >What I want it to look like > >12 10 >13 10 >14 10 >15 10 >16 10 >17 10 >18 10 >19 10 >20 10 > > >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 > Settings\Administrator\Desktop\data.txt'. > 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 >line. >NOTE: The data set WORK.TEST has 4 observations and 2 variables.


Back to: Top of message | Previous page | Main SAS-L page