Help using Base SAS procedures

Problems with SAS 9.2 - Reading of data by datastep produces error

Reply
N/A
Posts: 0

Problems with SAS 9.2 - Reading of data by datastep produces error

Dear all,
Hope this is the correct forum.

I have a problem regarding SAS version 9.2

I have a data reading procedure for a data set like this:

data RawData;
input Sampling Treat_ID Taxa_ID @@;
do Replicate = 1 to 4;
do Area = 1 to 4;
input Number Biomass @ ;
output;
end;
end;
datalines;
Here I copy-paste data directly from my excel spread sheet. - and end up with "run;" I often have 15 samplings, 5 Treat_ID and up to 40 Taxa_ID - to give you an impression about the volume of the dataset.

With SAS version 9.1.3 everything worked fine. I never received a message about a problem or a warning in the Log file.

Now with 9.2 sometimes I get error messages in the Log window like "Invalid data in line...". Sometimes SAS quits the complete programm without a warning or an error message after pressing the run buttom - and the reason seems to be the dataset as this problem does not occur if I feed it with a small data set. Sometimes (especially if datasets are small) the data step works fine and the resulting table of the dataset is absolutely correct.

I do not what to do. Maybe I'll go back to 9.1.3. I checked the data in Excel and it was not corrupt or damaged - but SAS e.g. makes an "." out of an "0.00" - but only at single datapoints of a dataset with thousands of data - and not always at the same. The system seems to be not stable.

Does anyone have observed similar problems?
Any help is welcome.

Best regards
Holger
Super User
Posts: 5,256

Re: Problems with SAS 9.2 - Reading of data by datastep produces error

Copy and paste doesn't sound like organized way of running programs repeatedly. I would much more prefer importing the Excel using PROC IMPORT, or LIBNAME excel engine. Even an export from Excel to a csv/tab-delimited file seems a bit more structured.

If you want this copy/paste to work: try to paste your Excel data into any other application, and search for the lines where SAS runs into problems. If this only occurs in SAS, I suggest that open a track to SAS tech support.

/Linus
Data never sleeps
N/A
Posts: 0

Re: Problems with SAS 9.2 - Reading of data by datastep produces error

Dear Linus,

thank you very much for your response.

Meanwhile I did several tests:
I copied the data from Excel into an simple editor - everything seemed to be OK.
I copied the data into Open Office Calc - everything seemed to be OK.

I copied the data from Open Office into the SAS programm - the programm immediatelly disappeared from my screen when pressing the Run button.
(Same data could be read when copying them from Excel - but with error messages).

The line where the problem occured was a very simple data line with only 0.00 values - so I copied a similar line where there was no problem just over the line where the problem occured - but the problem remained.

I made an installation of SAS 9.2 on a different computer - same problem.

What I should do next is to test your suggestions regarding Proc import or the technique with the Libname. I am not used to use these techniques but I know I should try to learn them. Hope I will make any progress soon.

Thank you again!
Best regards
Holger
N/A
Posts: 0

Re: Problems with SAS 9.2 - Reading of data by datastep produces error

Just a little update:

I tried to reduce the volume of data - just reduce it to the data of the sampling where the problem occurs - this means that the invalid data entry is still part of the dataset. The result: the datastep worked without any problem. So it seems not to be a data formating problem but a problem with a little bit tricky read algorythm for the data (2 loops) and a big data set.

I am surprised about this result as I did not expect problems like these with SAS.

Maybe I have mor luck with reading the data directly from Excel. I will inform you about my progress, but first I have to learn the technique.

Best regards
Holger
N/A
Posts: 0

Problem solved - thank you all!

First of all: Thank you for your help!

The problem seems to be solved:
The code as I used it first (you'll find it in my thread opening message
quoted below) runs fine with the simple editor but the enhanced editor of
9.2 has some problems with it.

I changed the code like this:
data RawData;
input Sampling Treat_ID Taxa_ID @@;
do Replicate = 1 to 4;
do Area = 1 to 4;
input Number Biomass @@ ;
output;
end;
end;
datalines;

-> the only thing I changed was filling in a second "@" in the line where I
read Number and Biomass.


With the changed code the programm runs fine also in 9.2 enhanced editor.
All data are read into the file fine (I checked it).

So the problem is solved.

But I will try to learn how to read the data directly from the Excel file
as you suppose it as the better way.

Thank you again and
best regards

Holger
N/A
Posts: 0

Hotfixes were the answer to my problem!

Dear all,

I found a way to solve my problem - even without using the simple - not the enhanced - editor or using strange code.

The answer was: I installed several hotfixes. Some of them have to do with the enhanced editor, which seems to cause problems in several cases.

Here's the page with the hotfixes regarding 9.2:
http://ftp.sas.com/techsup/download/hotfix/f9_win_sbcs.html#ba

Best regards
Holger
Ask a Question
Discussion stats
  • 5 replies
  • 88 views
  • 0 likes
  • 2 in conversation