04-09-2013 01:57 PM
I'm trying to reading in a .csv file, but getting an error message on reading in one variable. The variable is a person's ID number. When I read in the file using an infile statement, I see a note saying that "Invalid data for this variable." In the log, I see a period added to this variable, which does not exist in the original .csv file. For instance, I see "84031563578" in the .csv file, but I see ".84031563578" in the SAS log instead. I don't know where this period came from. Can anyone suggest how I can fix this problem? Thank you!!!
04-09-2013 05:21 PM
"Id.Number" indicates that the column contains only digits.
This is a far-out suggestion:
Compare your id to
Perhaps your id.numbers are greater than SAS can represent
which causes it to place the 'number' in a decimal format such as you are seeing.
Appropriately it ought to have a leading zero: 0.84031563578
next: 64-bit SAS
Ron Fehd id maven
04-09-2013 05:37 PM
Thank you all! I fixed an informat statement, and now it works! I also assigned a proper number of places for the variable.
But I got a new problem. I have a series of data sets - 11 data sets that represent a data set from each month from Feb 2012 to Dec 2012.
I tried to read in all files at once by using the FILENAME statement, for example,
*FILENAME indat (
and refer indat in my INFILE statement.
INFILE indat DSD TRUNCOVER FIRSTOBS=2 TERMSTR=CR;
The problem is that it treats the header from files other than the first referred file (i.e., mar2012 - dec2012) as observation and gives me an error message. For example, it reads the first row of the March data as an observation, which is in fact the header.
Should I make 11 different INFILE statements for data for each month? Is there an optional syntax in the FILENAME statement that I can specify that the first row of each external files should be treated as header?