BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
2 REPLIES 2
Doc_Duke
Rhodochrosite | Level 12
You need an INFILE statement in the initial DATA step to tell SAS where to find the data to put into work.test.
deleted_user
Not applicable
The statement (IF Zeit = THEN DO; ) would fail ... should be something like
(IF Zeit = 0 THEN DO;)

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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1009 views
  • 0 likes
  • 2 in conversation