Help using Base SAS procedures

Error in a program

Reply
N/A
Posts: 0

Error in a program

I have an error in this program and I didn´t found the reason. When I start it the log file told me that the variables did not exist, but in my data table I had labelled the columns with Paar, Geburt, Zeit, Lebende (all numeric). Paar is organized like this 1 1 1 1...., 2 2 2 2...., 3 3 3 3.., etc. Geburt also. "Zeit" is time from day 1 to 10. and Lebende ist survival from a beginning of 50 individuals.

DATA work.test;
input Paar Geburt Zeit Lebende;

PROC SORT DATA=work.test;
BY Paar Geburt Zeit;

DATA test;
RETAIN n0;
SET work.test;

IF Zeit = THEN DO;
n0 = Lebende;
END;

PctLebend = 100*Lebende/n0;
RUN;

PROC SORT DATA=work.test;
BY Paar Zeit;

PROC MEANS DATA=work.test N MEAN STD CLM;
VAR PctLebende;
BY Paar Zeit;
OUTPUT OUT=mtest MEAN=mPctLebende LCLM=loPctLebende UCLM=upPctLebende;
RUN;

SYMBOL1 I=JOIN V=DOT C=BLUE;
SYMBOL2 I=JOIN V=NONE C=BLUE L=3;

PROC GPLOT DATA=mtest;
PLOT mPctLebende * Zeit = 1
loPctLebende * Zeit = 2
upPctLebende * Zeit = 2 / OVERLAY;
BY Paar;
RUN;
QUIT;
Thanks a lot for help!! Message was edited by: bio
Trusted Advisor
Posts: 2,113

Re: Error in a program

You need an INFILE statement in the initial DATA step to tell SAS where to find the data to put into work.test.
N/A
Posts: 0

Re: Error in a program

The statement (IF Zeit = THEN DO; ) would fail ... should be something like
(IF Zeit = 0 THEN DOSmiley Wink

I mean a numeric value (may be a . for missing values) after the equal sign

again In your:
PROC MEANS DATA=work.test N MEAN STD CLM;
VAR PctLebende;
BY Paar Zeit;
OUTPUT OUT=mtest MEAN=mPctLebende LCLM=loPctLebende UCLM=upPctLebende;
RUN;

the VAR statement specify (PCTLEBENDE) variable as analysis variable while your dataset has no (PCTLEBENDE) variable at all. also... failure of any of the above data steps or SAS PROCs that create a datasets, may cause the rest of your program to feed on empty datasets ... etc potential for such error messages
Ask a Question
Discussion stats
  • 2 replies
  • 107 views
  • 0 likes
  • 2 in conversation