BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ruhi
Obsidian | Level 7

data mydata  ;

input score1_score3;

sum ( of score1-score3)= s;

datalines;

23 36 .

23 67 89

.  .  .

21 .  43

22 32 78

;

run;

I made up this data set , which resembles my real data problem with using sum function and got following error. I don't understand it, I checked sas documentation and examples. This is the way sas has given examples to find sum of entries in variables. Why is this not working????? what is meant by the following error.

7173  data mydata  ;

7174  input score1_score3;

7175  sum ( of score1-score3)= s;

ERROR: Undeclared array referenced: sum.

ERROR: Variable sum has not been declared as an array.

7176  datalines;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Possible typo: score1_score3 resulting in single variable, score1 - score 3 likely intended. If this is what executed then the variables score1 through score3 were not created.

Order of expression:

s = sum (of scor1 - score3);  The receiving value MUST be on the left of the =. Basically the construct variablename() = value is reserved for arrays.

View solution in original post

2 REPLIES 2
ballardw
Super User

Possible typo: score1_score3 resulting in single variable, score1 - score 3 likely intended. If this is what executed then the variables score1 through score3 were not created.

Order of expression:

s = sum (of scor1 - score3);  The receiving value MUST be on the left of the =. Basically the construct variablename() = value is reserved for arrays.

stat_sas
Ammonite | Level 13

data mydata;

infile datalines missover;

input score1 score2 score3;

s=sum(of score1-score3);

datalines;

23 36 .

23 67 89

.  .  .

21 .  43

22 32 78

;

run;

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
  • 2230 views
  • 1 like
  • 3 in conversation