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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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