From: Anaconda on
Here is a simple piece of code that causes an error and warning in the
SAS log. I don't understand this errror message, what it tries to tell
me:

data testdata;
length Testpunkt $2.;
input Testpunkt;
datalines;
02
09
09
09
16
16
17
19
19
;
run;
Filename GenFile "D:\SAS_KODE\Generate_testdata.sas";
data _null_;
set testdata end = last;
by Testpunkt;
file GenFile linesize = 32767;
if Testpunkt.first then do;
x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
'_samanfatning' ;
x02 = 'set testdata;' ;
x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
output;' ;
put @01 x01;
put @04 x02;
put @04 x03;
end;
if Testpunkt.last then do;
x04 = 'run;' ;
put @01 x04;
end;
run;

%include GenFile;



/*
11877 data _null_;
11878 set testdata end = last;
11879 by Testpunkt;
11880 file GenFile linesize = 32767;
11881 if Testpunkt.first then do;
---------------
557
ERROR: DATA STEP Component Object failure. Aborted during the
COMPILATION phase.
ERROR 557-185: Variable Testpunkt is not an object.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

11882 x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
'_samanfatning' ;
11883 x02 = 'set testdata;' ;
11884 x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
output;' ;
1
12039
12040 %include GenFile;
WARNING: Physical file does not exist, D:\SAS_KODE
\Generate_testdata.sas.
ERROR: Cannot open %INCLUDE file GENFILE.
*/

The code is not real, but the problem is real. The code is
oversimplified. It is about getting SAS to create code based on a
dataset (in this case the dataset TESTDATA.

- Anaconda


From: a on
On Sep 28, 12:23 pm, Anaconda <r...(a)fastlane.no> wrote:
> Here is a simple piece of code that causes an error and warning in the
> SAS log. I don't understand this errror message, what it tries to tell
> me:
>
> data testdata;
>    length Testpunkt $2.;
>    input Testpunkt;
>    datalines;
> 02
> 09
> 09
> 09
> 16
> 16
> 17
> 19
> 19
> ;
> run;
> Filename GenFile "D:\SAS_KODE\Generate_testdata.sas";
> data _null_;
>    set testdata end = last;
>    by Testpunkt;
>    file GenFile linesize = 32767;
>    if Testpunkt.first then do;
>       x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
> '_samanfatning' ;
>       x02 = 'set testdata;' ;
>       x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
> output;' ;
>       put @01 x01;
>       put @04 x02;
>       put @04 x03;
>    end;
>    if Testpunkt.last then do;
>       x04 = 'run;' ;
>       put @01 x04;
>    end;
> run;
>
> %include GenFile;
>
> /*
> 11877  data _null_;
> 11878     set testdata end = last;
> 11879     by Testpunkt;
> 11880     file GenFile linesize = 32767;
> 11881     if Testpunkt.first then do;
>              ---------------
>              557
> ERROR: DATA STEP Component Object failure.  Aborted during the
> COMPILATION phase.
> ERROR 557-185: Variable Testpunkt is not an object.
>
> NOTE: The SAS System stopped processing this step because of errors.
> NOTE: DATA statement used (Total process time):
>       real time           0.00 seconds
>       cpu time            0.00 seconds
>
> 11882        x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
> '_samanfatning' ;
> 11883        x02 = 'set testdata;' ;
> 11884        x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
> output;' ;
> 1
> 12039
> 12040  %include GenFile;
> WARNING: Physical file does not exist, D:\SAS_KODE
> \Generate_testdata.sas.
> ERROR: Cannot open %INCLUDE file GENFILE.
> */
>
> The code is not real, but the problem is real. The code is
> oversimplified. It is about getting SAS to create code based on a
> dataset (in this case the dataset TESTDATA.
>
> - Anaconda

I think you want

if FIRST.Testpunkt then do;

instead of ....
if Testpunkt.first then do;
From: Randy Herbison on
Testpunkt.first is being interpreted as dot notation. It should be first.Testpunkt and Testpunkt.last should be last.Testpunkt







-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of Anaconda
Sent: Monday, September 28, 2009 1:24 PM
To: SAS-L(a)LISTSERV.UGA.EDU
Subject: ERROR: DATA STEP Component Object failure

Here is a simple piece of code that causes an error and warning in the
SAS log. I don't understand this errror message, what it tries to tell
me:

data testdata;
length Testpunkt $2.;
input Testpunkt;
datalines;
02
09
09
09
16
16
17
19
19
;
run;
Filename GenFile "D:\SAS_KODE\Generate_testdata.sas";
data _null_;
set testdata end = last;
by Testpunkt;
file GenFile linesize = 32767;
if Testpunkt.first then do;
x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
'_samanfatning' ;
x02 = 'set testdata;' ;
x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
output;' ;
put @01 x01;
put @04 x02;
put @04 x03;
end;
if Testpunkt.last then do;
x04 = 'run;' ;
put @01 x04;
end;
run;

%include GenFile;



/*
11877 data _null_;
11878 set testdata end = last;
11879 by Testpunkt;
11880 file GenFile linesize = 32767;
11881 if Testpunkt.first then do;
---------------
557
ERROR: DATA STEP Component Object failure. Aborted during the
COMPILATION phase.
ERROR 557-185: Variable Testpunkt is not an object.

NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

11882 x01 = 'data work.Meta_tp' ||compress(Testpunkt) ||
'_samanfatning' ;
11883 x02 = 'set testdata;' ;
11884 x03 = 'if Testpunkt eq' || compress(Testpunkt) || ' then
output;' ;
1
12039
12040 %include GenFile;
WARNING: Physical file does not exist, D:\SAS_KODE
\Generate_testdata.sas.
ERROR: Cannot open %INCLUDE file GENFILE.
*/

The code is not real, but the problem is real. The code is
oversimplified. It is about getting SAS to create code based on a
dataset (in this case the dataset TESTDATA.

- Anaconda
From: "Vandenbroucke, David A" on
>Date: Mon, 28 Sep 2009 14:09:31 -0400
>From: Randy Herbison <RandyHerbison(a)WESTAT.COM>
>Subject: Re: ERROR: DATA STEP Component Object failure

>Testpunkt.first is being interpreted as dot notation. It should be first.Testpunkt and >Testpunkt.last should be last.Testpunkt

It's the little things that make you bang your head on things. :)

Dav Vandenbroucke
Senior Economist
U.S. Dept. HUD
david.a.vandenbroucke(a)hud.gov
202-402-5890

I disclaim any disclaimers.